From 8c1171e9234f055fe44313077528ee7491156146 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 28 Mar 2012 04:42:23 -0400 Subject: Move test skipping to class setup Currently, each DNS test case first checks if DNS is configured by creating and deleting a test zone. This takes quite a lot of time. This patch moves the check to the setUpClass method, so the check is only done once for all the tests. Similarly, if the server is not available, entire XMLRPC test classes are now skipped. Additionally, CLItests that hit the server are skipped if the server isn't available. --- tests/test_xmlrpc/xmlrpc_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/test_xmlrpc/xmlrpc_test.py') diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py index a7cfb11b..28f5fac7 100644 --- a/tests/test_xmlrpc/xmlrpc_test.py +++ b/tests/test_xmlrpc/xmlrpc_test.py @@ -122,11 +122,13 @@ class XMLRPC_test(object): Base class for all XML-RPC plugin tests """ - def setUp(self): + @classmethod + def setUpClass(cls): if not server_available: - raise nose.SkipTest( - 'Server not available: %r' % api.env.xmlrpc_uri - ) + raise nose.SkipTest('%r: Server not available: %r' % + (cls.__module__, api.env.xmlrpc_uri)) + + def setUp(self): if not api.Backend.xmlclient.isconnected(): api.Backend.xmlclient.connect(fallback=False) -- cgit