From 93c69b51278ef5a6b04047b7d38f619101d0d184 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 8 Oct 2014 09:42:52 +0200 Subject: Use setup_class/teardown_class in Declarative tests Pytest will consider each Declarative test individually, running setup/teardown for each one. Move the setup and teardown to the class level. https://fedorahosted.org/freeipa/ticket/4610 Reviewed-By: Tomas Babej --- ipatests/test_xmlrpc/test_cert_plugin.py | 2 -- ipatests/test_xmlrpc/xmlrpc_test.py | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'ipatests/test_xmlrpc') diff --git a/ipatests/test_xmlrpc/test_cert_plugin.py b/ipatests/test_xmlrpc/test_cert_plugin.py index a19032503..c878504b2 100644 --- a/ipatests/test_xmlrpc/test_cert_plugin.py +++ b/ipatests/test_xmlrpc/test_cert_plugin.py @@ -84,7 +84,6 @@ class test_cert(XMLRPC_test): return ipautil.run(new_args, stdin) def setup(self): - super(test_cert, self).setup() self.reqdir = tempfile.mkdtemp(prefix = "tmp-") self.reqfile = self.reqdir + "/test.csr" self.pwname = self.reqdir + "/pwd" @@ -100,7 +99,6 @@ class test_cert(XMLRPC_test): self.subject = DN(('CN', self.host_fqdn), x509.subject_base()) def teardown(self): - super(test_cert, self).teardown() shutil.rmtree(self.reqdir, ignore_errors=True) def generateCSR(self, subject): diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py index 2030f1cb2..1f44f7794 100644 --- a/ipatests/test_xmlrpc/xmlrpc_test.py +++ b/ipatests/test_xmlrpc/xmlrpc_test.py @@ -172,15 +172,11 @@ class XMLRPC_test(object): if not server_available: raise nose.SkipTest('%r: Server not available: %r' % (cls.__module__, api.env.xmlrpc_uri)) - - def setup(self): if not api.Backend.rpcclient.isconnected(): api.Backend.rpcclient.connect(fallback=False) - def teardown(self): - """ - nose tear-down fixture. - """ + @classmethod + def teardown_class(cls): request.destroy_context() def failsafe_add(self, obj, pk, **options): -- cgit