summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-09-24 13:56:21 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-10-03 19:50:30 +0200
commit8acd7be55b724c34d1d7aa169cbdeeffb7545c80 (patch)
treea3891a11750e94c60a10648893facde82205442f
parentafefb688b7184269b66e71f0b8de2fcd04bce911 (diff)
downloadfreeipa.git-8acd7be55b724c34d1d7aa169cbdeeffb7545c80.tar.gz
freeipa.git-8acd7be55b724c34d1d7aa169cbdeeffb7545c80.tar.xz
freeipa.git-8acd7be55b724c34d1d7aa169cbdeeffb7545c80.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.py9
-rw-r--r--ipatests/test_integration/test_caless.py1
2 files changed, 9 insertions, 1 deletions
diff --git a/ipatests/beakerlib_plugin.py b/ipatests/beakerlib_plugin.py
index 2635e4b8..45f34c6a 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 452ea9e2..a326e1eb 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):