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.
This commit is contained in:
Petr Viktorin 2013-09-24 13:56:21 +02:00
parent 0ad339a731
commit f2e8624e76
2 changed files with 9 additions and 1 deletions

View File

@ -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'):

View File

@ -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):