diff options
| author | Martin Basti <mbasti@redhat.com> | 2016-09-26 18:22:22 +0200 |
|---|---|---|
| committer | Martin Basti <mbasti@redhat.com> | 2016-09-27 13:35:58 +0200 |
| commit | 9d83be3647547cfca4e129cfeb63771213232cf7 (patch) | |
| tree | 0899bfbc662355dd8d1318b5e6d4909c5aaa993c /ipatests/test_ipalib | |
| parent | 0f88f8fe889ae4801fc8d5ece1ad51c5246718ac (diff) | |
Remove unused variables in tests
This commit removes or marks unused variables as "expected to be unused"
by using '_' prefix.
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipatests/test_ipalib')
| -rw-r--r-- | ipatests/test_ipalib/test_backend.py | 2 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_base.py | 6 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_config.py | 6 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_crud.py | 2 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_errors.py | 2 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_plugable.py | 10 | ||||
| -rw-r--r-- | ipatests/test_ipalib/test_x509.py | 10 |
7 files changed, 17 insertions, 21 deletions
diff --git a/ipatests/test_ipalib/test_backend.py b/ipatests/test_ipalib/test_backend.py index 6fb2d8558..9fd99d8a3 100644 --- a/ipatests/test_ipalib/test_backend.py +++ b/ipatests/test_ipalib/test_backend.py @@ -189,7 +189,7 @@ class test_Executioner(ClassChecker): """ Test the `ipalib.backend.Executioner.execute` method. """ - (api, home) = create_test_api(in_server=True) + api, _home = create_test_api(in_server=True) class echo(Command): takes_args = ('arg1', 'arg2+') diff --git a/ipatests/test_ipalib/test_base.py b/ipatests/test_ipalib/test_base.py index d69ee67f6..c4e4a4cd6 100644 --- a/ipatests/test_ipalib/test_base.py +++ b/ipatests/test_ipalib/test_base.py @@ -263,9 +263,9 @@ class test_NameSpace(ClassChecker): Test the `ipalib.base.NameSpace.__len__` method. """ for count in (5, 18, 127): - (o, members) = self.new(count) + o, _members = self.new(count) assert len(o) == count - (o, members) = self.new(count, sort=False) + o, _members = self.new(count, sort=False) assert len(o) == count def test_iter(self): @@ -353,7 +353,7 @@ class test_NameSpace(ClassChecker): """ for cnt in (0, 1, 2): for sort in (True, False): - (o, members) = self.new(cnt, sort=sort) + o, _members = self.new(cnt, sort=sort) if cnt == 1: assert repr(o) == \ 'NameSpace(<%d member>, sort=%r)' % (cnt, sort) diff --git a/ipatests/test_ipalib/test_config.py b/ipatests/test_ipalib/test_config.py index 22851559a..22373e150 100644 --- a/ipatests/test_ipalib/test_config.py +++ b/ipatests/test_ipalib/test_config.py @@ -577,7 +577,7 @@ class test_Env(ClassChecker): Test the `ipalib.config.Env._finalize` method. """ # Check that calls cascade up the chain: - (o, home) = self.new(in_tree=True) + o, _home = self.new(in_tree=True) assert o._isdone('_bootstrap') is False assert o._isdone('_finalize_core') is False assert o._isdone('_finalize') is False @@ -591,7 +591,7 @@ class test_Env(ClassChecker): assert str(e) == 'Env._finalize() already called' # Check that _finalize() calls __lock__() - (o, home) = self.new(in_tree=True) + o, _home = self.new(in_tree=True) assert o.__islocked__() is False o._finalize() assert o.__islocked__() is True @@ -599,7 +599,7 @@ class test_Env(ClassChecker): assert str(e) == 'Env.__lock__() already called' # Check that **lastchance works - (o, home) = self.finalize_core(None) + o, _home = self.finalize_core(None) key = 'just_one_more_key' value = u'with one more value' lastchance = {key: value} diff --git a/ipatests/test_ipalib/test_crud.py b/ipatests/test_ipalib/test_crud.py index 125b82465..705ff3c16 100644 --- a/ipatests/test_ipalib/test_crud.py +++ b/ipatests/test_ipalib/test_crud.py @@ -38,7 +38,7 @@ class CrudChecker(ClassChecker): """ Return a finalized `ipalib.plugable.API` instance. """ - (api, home) = get_api() + api, _home = get_api() class user(frontend.Object): takes_params = ( 'givenname', diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index 8bf2cba45..43cd92654 100644 --- a/ipatests/test_ipalib/test_errors.py +++ b/ipatests/test_ipalib/test_errors.py @@ -243,7 +243,6 @@ class test_PublicError(PublicExceptionTester): def test_init(self): message = u'The translated, interpolated message' format = 'key=%(key1)r and key2=%(key2)r' - uformat = u'Translated key=%(key1)r and key2=%(key2)r' val1 = u'Value 1' val2 = u'Value 2' kw = dict(key1=val1, key2=val2) @@ -303,7 +302,6 @@ class test_PublicError(PublicExceptionTester): class subclass(self.klass): format = '%(true)r %(text)r %(number)r' - uformat = u'Translated %(true)r %(text)r %(number)r' kw = dict(true=True, text=u'Hello!', number=18) # Test with format=str, message=None diff --git a/ipatests/test_ipalib/test_plugable.py b/ipatests/test_ipalib/test_plugable.py index 8617c7343..1ee110250 100644 --- a/ipatests/test_ipalib/test_plugable.py +++ b/ipatests/test_ipalib/test_plugable.py @@ -103,14 +103,12 @@ def test_Registry(): pass class Base2(object): pass - class Base3(object): - pass + + class plugin1(Base1): pass class plugin2(Base2): pass - class plugin3(Base3): - pass # Test creation of Registry: r = plugable.Registry() @@ -250,7 +248,7 @@ class test_API(ClassChecker): """ Test the `ipalib.plugable.API.bootstrap` method. """ - (o, home) = create_test_api() + o, _home = create_test_api() assert o.env._isdone('_bootstrap') is False assert o.env._isdone('_finalize_core') is False assert o.isdone('bootstrap') is False @@ -266,7 +264,7 @@ class test_API(ClassChecker): """ Test the `ipalib.plugable.API.load_plugins` method. """ - (o, home) = create_test_api() + o, _home = create_test_api() assert o.isdone('bootstrap') is False assert o.isdone('load_plugins') is False o.load_plugins() diff --git a/ipatests/test_ipalib/test_x509.py b/ipatests/test_ipalib/test_x509.py index 32d0e8561..f765bc964 100644 --- a/ipatests/test_ipalib/test_x509.py +++ b/ipatests/test_ipalib/test_x509.py @@ -55,20 +55,20 @@ class test_x509(object): """ # Load a good cert - cert = x509.load_certificate(goodcert) + x509.load_certificate(goodcert) # Load a good cert with headers newcert = '-----BEGIN CERTIFICATE-----' + goodcert + '-----END CERTIFICATE-----' - cert = x509.load_certificate(newcert) + x509.load_certificate(newcert) # Load a good cert with bad headers newcert = '-----BEGIN CERTIFICATE-----' + goodcert with pytest.raises((TypeError, ValueError)): - cert = x509.load_certificate(newcert) + x509.load_certificate(newcert) # Load a bad cert with pytest.raises(NSPRError): - cert = x509.load_certificate(badcert) + x509.load_certificate(badcert) def test_1_load_der_cert(self): """ @@ -78,7 +78,7 @@ class test_x509(object): der = base64.b64decode(goodcert) # Load a good cert - cert = x509.load_certificate(der, x509.DER) + x509.load_certificate(der, x509.DER) def test_2_get_subject(self): """ |
