diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-06 21:11:27 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-06 21:11:27 +0000 |
commit | 8fc5005dfe3eb66a46470ad8a8c7b95fc4d6bdca (patch) | |
tree | ae9e27d12c9fbf8297bb90469509e1cb6a206242 /test/base/test_except.py | |
parent | 7638aa7f242c6ea3d743aa9100e32be2052546a6 (diff) | |
download | sqlalchemy-8fc5005dfe3eb66a46470ad8a8c7b95fc4d6bdca.tar.gz |
merge 0.6 series to trunk.
Diffstat (limited to 'test/base/test_except.py')
-rw-r--r-- | test/base/test_except.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/base/test_except.py b/test/base/test_except.py index efb18a153..fbe0a05de 100644 --- a/test/base/test_except.py +++ b/test/base/test_except.py @@ -1,10 +1,14 @@ """Tests exceptions and DB-API exception wrapping.""" -import exceptions as stdlib_exceptions from sqlalchemy import exc as sa_exceptions from sqlalchemy.test import TestBase +# Py3K +#StandardError = BaseException +# Py2K +from exceptions import StandardError, KeyboardInterrupt, SystemExit +# end Py2K -class Error(stdlib_exceptions.StandardError): +class Error(StandardError): """This class will be old-style on <= 2.4 and new-style on >= 2.5.""" class DatabaseError(Error): pass @@ -101,19 +105,19 @@ class WrapTest(TestBase): def test_db_error_keyboard_interrupt(self): try: raise sa_exceptions.DBAPIError.instance( - '', [], stdlib_exceptions.KeyboardInterrupt()) + '', [], KeyboardInterrupt()) except sa_exceptions.DBAPIError: self.assert_(False) - except stdlib_exceptions.KeyboardInterrupt: + except KeyboardInterrupt: self.assert_(True) def test_db_error_system_exit(self): try: raise sa_exceptions.DBAPIError.instance( - '', [], stdlib_exceptions.SystemExit()) + '', [], SystemExit()) except sa_exceptions.DBAPIError: self.assert_(False) - except stdlib_exceptions.SystemExit: + except SystemExit: self.assert_(True) |