diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-09-24 13:56:21 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-10-03 19:50:35 +0200 |
commit | f2e8624e767efcbf345a740b191f93a239685442 (patch) | |
tree | 2a66b429568e931afe019ea7eaad4430bdd9af68 | |
parent | 0ad339a73134d08aebe9a6f72b001816bdcb9c1d (diff) | |
download | freeipa-f2e8624e767efcbf345a740b191f93a239685442.tar.gz freeipa-f2e8624e767efcbf345a740b191f93a239685442.tar.xz freeipa-f2e8624e767efcbf345a740b191f93a239685442.zip |
ipatests.beakerlib_plugin: Add argument of generated tests to test captions
To differentiate between individual tests in BeakerLib output,
the argument needs to be added to the test name. Since Nose
doesn't provide a way to get the argument in a plugin,
a `test_argument` attribute must be added to the test function
to support this, simlarly to how `description` is used to set
individual "docstrings".
Add test_argument to the generated tests in the CA-less suite.
-rw-r--r-- | ipatests/beakerlib_plugin.py | 9 | ||||
-rw-r--r-- | ipatests/test_integration/test_caless.py | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ipatests/beakerlib_plugin.py b/ipatests/beakerlib_plugin.py index 2635e4b80..45f34c6a6 100644 --- a/ipatests/beakerlib_plugin.py +++ b/ipatests/beakerlib_plugin.py @@ -233,7 +233,14 @@ class BeakerLibPlugin(Plugin): caption = test.shortDescription() if not caption: caption = 'Nose method (no docstring)' - phase_name = "%s: %s" % (test.id().replace('.', '-'), caption) + phase_name = test.id().replace('.', '-') + method = test + while hasattr(method, 'test'): + method = method.test + argument = getattr(method, 'test_argument', None) + if argument: + phase_name += '-%s' % re.sub('[^-a-zA-Z0-9]+', '_', str(argument)) + phase_name += ": %s" % caption self.run_beakerlib_command(['rlPhaseStart', 'FAIL', phase_name]) while hasattr(test, 'test'): diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py index 452ea9e2e..a326e1eba 100644 --- a/ipatests/test_integration/test_caless.py +++ b/ipatests/test_integration/test_caless.py @@ -1092,6 +1092,7 @@ class TestIPACommands(CALessBase): 'cert-status'): func = lambda: self.check_ipa_command_not_available(cmd) func.description = 'Verify that %s command is not available' % cmd + func.test_argument = cmd yield (func, ) def test_cert_help_unavailable(self): |