diff options
author | Robert Kuska <rkuska@redhat.com> | 2015-08-24 12:40:33 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-09-30 10:51:36 +0200 |
commit | 01da4a8de3ed8651cc95df6125751e1603dbd14e (patch) | |
tree | 823856bad461808163b3fc05c54e0d87d26dd381 /ipatests/test_ipalib | |
parent | 34e6c3ea05b23f4a5fe6fb6aaadd394967f31340 (diff) | |
download | freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.tar.gz freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.tar.xz freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.zip |
Replace StandardError with Exception
StandardError was removed in Python3 and instead
Exception should be used.
Signed-off-by: Robert Kuska <rkuska@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipatests/test_ipalib')
-rw-r--r-- | ipatests/test_ipalib/test_backend.py | 6 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_config.py | 10 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_errors.py | 10 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_plugable.py | 8 |
4 files changed, 17 insertions, 17 deletions
diff --git a/ipatests/test_ipalib/test_backend.py b/ipatests/test_ipalib/test_backend.py index f7887bf64..4e014f654 100644 --- a/ipatests/test_ipalib/test_backend.py +++ b/ipatests/test_ipalib/test_backend.py @@ -90,9 +90,9 @@ class test_Connectible(ClassChecker): assert conn.conn == 'The connection.' assert conn.disconnect == o.disconnect - # Test that StandardError is raised if already connected: + # Test that Exception is raised if already connected: m = "connect: 'context.%s' already exists in thread %r" - e = raises(StandardError, o.connect, *args, **kw) + e = raises(Exception, o.connect, *args, **kw) assert str(e) == m % ('example', threading.currentThread().getName()) # Double check that it works after deleting context.example: @@ -121,7 +121,7 @@ class test_Connectible(ClassChecker): o = example(api, shared_instance=True) m = "disconnect: 'context.%s' does not exist in thread %r" - e = raises(StandardError, o.disconnect) + e = raises(Exception, o.disconnect) assert str(e) == m % ('example', threading.currentThread().getName()) context.example = 'The connection.' diff --git a/ipatests/test_ipalib/test_config.py b/ipatests/test_ipalib/test_config.py index b8cba516d..5a0de1e1f 100644 --- a/ipatests/test_ipalib/test_config.py +++ b/ipatests/test_ipalib/test_config.py @@ -166,7 +166,7 @@ class test_Env(ClassChecker): assert o.__islocked__() is False o.__lock__() assert o.__islocked__() is True - e = raises(StandardError, o.__lock__) + e = raises(Exception, o.__lock__) assert str(e) == 'Env.__lock__() already called' # Also test with base.lock() function: @@ -429,7 +429,7 @@ class test_Env(ClassChecker): assert o._isdone('_bootstrap') is False o._bootstrap(**overrides) assert o._isdone('_bootstrap') is True - e = raises(StandardError, o._bootstrap) + e = raises(Exception, o._bootstrap) assert str(e) == 'Env._bootstrap() already called' return (o, home) @@ -512,7 +512,7 @@ class test_Env(ClassChecker): assert key in o # Check that it can't be called twice: - e = raises(StandardError, o._finalize_core) + e = raises(Exception, o._finalize_core) assert str(e) == 'Env._finalize_core() already called' return (o, home) @@ -586,7 +586,7 @@ class test_Env(ClassChecker): assert o._isdone('_finalize') is True # Check that it can't be called twice: - e = raises(StandardError, o._finalize) + e = raises(Exception, o._finalize) assert str(e) == 'Env._finalize() already called' # Check that _finalize() calls __lock__() @@ -594,7 +594,7 @@ class test_Env(ClassChecker): assert o.__islocked__() is False o._finalize() assert o.__islocked__() is True - e = raises(StandardError, o.__lock__) + e = raises(Exception, o.__lock__) assert str(e) == 'Env.__lock__() already called' # Check that **lastchance works diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index 8cc9cd276..6dd9e6cce 100644 --- a/ipatests/test_ipalib/test_errors.py +++ b/ipatests/test_ipalib/test_errors.py @@ -45,7 +45,7 @@ class PrivateExceptionTester(object): def __get_klass(self): if self.__klass is None: self.__klass = self._klass - assert issubclass(self.__klass, StandardError) + assert issubclass(self.__klass, Exception) assert issubclass(self.__klass, errors.PrivateError) assert not issubclass(self.__klass, errors.PublicError) return self.__klass @@ -55,7 +55,7 @@ class PrivateExceptionTester(object): for (key, value) in kw.items(): assert not hasattr(self.klass, key), key inst = self.klass(**kw) - assert isinstance(inst, StandardError) + assert isinstance(inst, Exception) assert isinstance(inst, errors.PrivateError) assert isinstance(inst, self.klass) assert not isinstance(inst, errors.PublicError) @@ -203,7 +203,7 @@ class PublicExceptionTester(object): def __get_klass(self): if self.__klass is None: self.__klass = self._klass - assert issubclass(self.__klass, StandardError) + assert issubclass(self.__klass, Exception) assert issubclass(self.__klass, errors.PublicError) assert not issubclass(self.__klass, errors.PrivateError) assert type(self.__klass.errno) is int @@ -234,7 +234,7 @@ class test_PublicError(PublicExceptionTester): Test the `ipalib.errors.PublicError` exception. """ _klass = errors.PublicError - required_classes = StandardError, errors.PublicError + required_classes = Exception, errors.PublicError def test_init(self): message = u'The translated, interpolated message' @@ -375,7 +375,7 @@ class BaseMessagesTest(object): class test_PublicErrors(object): message_list = errors.public_errors errno_range = list(range(900, 5999)) - required_classes = (StandardError, errors.PublicError) + required_classes = (Exception, errors.PublicError) texts = errors._texts def extratest(self, cls): diff --git a/ipatests/test_ipalib/test_plugable.py b/ipatests/test_ipalib/test_plugable.py index 148139464..caf08d6b9 100644 --- a/ipatests/test_ipalib/test_plugable.py +++ b/ipatests/test_ipalib/test_plugable.py @@ -80,7 +80,7 @@ class test_Plugin(ClassChecker): # whose names conflict with the logger methods set in Plugin.__init__(): class check(self.cls): info = 'whatever' - e = raises(StandardError, check, api) + e = raises(Exception, check, api) assert str(e) == \ "info is already bound to ipatests.test_ipalib.test_plugable.check()" @@ -257,7 +257,7 @@ class test_API(ClassChecker): assert inst.method(7) == 7 + b # Test that calling finilize again raises AssertionError: - e = raises(StandardError, api.finalize) + e = raises(Exception, api.finalize) assert str(e) == 'API.finalize() already called', str(e) def test_bootstrap(self): @@ -273,7 +273,7 @@ class test_API(ClassChecker): assert o.env._isdone('_bootstrap') is True assert o.env._isdone('_finalize_core') is True assert o.env.my_test_override == 'Hello, world!' - e = raises(StandardError, o.bootstrap) + e = raises(Exception, o.bootstrap) assert str(e) == 'API.bootstrap() already called' def test_load_plugins(self): @@ -286,5 +286,5 @@ class test_API(ClassChecker): o.load_plugins() assert o.isdone('bootstrap') is True assert o.isdone('load_plugins') is True - e = raises(StandardError, o.load_plugins) + e = raises(Exception, o.load_plugins) assert str(e) == 'API.load_plugins() already called' |