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_cmdline/test_cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/test_cmdline/test_cli.py') diff --git a/tests/test_cmdline/test_cli.py b/tests/test_cmdline/test_cli.py index 889aae41..46b33d54 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): -- cgit