summaryrefslogtreecommitdiffstats
path: root/tests/test_cmdline
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2012-03-28 04:42:23 -0400
committerRob Crittenden <rcritten@redhat.com>2012-04-01 16:21:10 -0400
commit8c1171e9234f055fe44313077528ee7491156146 (patch)
tree8380c0e4d82ae904477baac80a9e2b135a0c5da2 /tests/test_cmdline
parent16b38d39b36eb0b39a77720e30ac4321e902e66b (diff)
downloadfreeipa-8c1171e9234f055fe44313077528ee7491156146.tar.gz
freeipa-8c1171e9234f055fe44313077528ee7491156146.tar.xz
freeipa-8c1171e9234f055fe44313077528ee7491156146.zip
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.
Diffstat (limited to 'tests/test_cmdline')
-rw-r--r--tests/test_cmdline/test_cli.py6
1 files changed, 5 insertions, 1 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):