diff options
-rw-r--r-- | tests/test_cmdline/test_cli.py | 6 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_dns_plugin.py | 8 | ||||
-rw-r--r-- | tests/test_xmlrpc/xmlrpc_test.py | 10 |
3 files changed, 17 insertions, 7 deletions
diff --git a/tests/test_cmdline/test_cli.py b/tests/test_cmdline/test_cli.py index 889aae413..46b33d548 100644 --- a/tests/test_cmdline/test_cli.py +++ b/tests/test_cmdline/test_cli.py @@ -26,7 +26,11 @@ class TestCLIParsing(object): """Run a command on the server""" if not api.Backend.xmlclient.isconnected(): api.Backend.xmlclient.connect(fallback=False) - api.Command[command_name](**kw) + try: + api.Command[command_name](**kw) + except errors.NetworkError: + raise nose.SkipTest('%r: Server not available: %r' % + (self.__module__, api.env.xmlrpc_uri)) @contextlib.contextmanager def fake_stdin(self, string_in): diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py index 1e5ab7917..966394532 100644 --- a/tests/test_xmlrpc/test_dns_plugin.py +++ b/tests/test_xmlrpc/test_dns_plugin.py @@ -47,8 +47,12 @@ dnsrev2_dn = DN(('idnsname',dnsrev2), revdnszone1_dn) class test_dns(Declarative): - def setUp(self): - super(test_dns, self).setUp() + @classmethod + def setUpClass(cls): + super(test_dns, cls).setUpClass() + + if not api.Backend.xmlclient.isconnected(): + api.Backend.xmlclient.connect(fallback=False) try: api.Command['dnszone_add'](dnszone1, idnssoamname = dnszone1_mname, diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py index a7cfb11b8..28f5fac7b 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) |