summaryrefslogtreecommitdiffstats
path: root/ipatests/beakerlib_plugin.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-06-17 04:41:06 -0400
committerPetr Viktorin <pviktori@redhat.com>2013-07-15 15:49:13 +0200
commit19a0d51d89b640c04dc285067fc59b4a7fe9ca7f (patch)
tree11201c89fbcbc77f8210cf85da4e2c90677906d6 /ipatests/beakerlib_plugin.py
parenta02890526ed099f7b37684295ca67d49b4c1737b (diff)
downloadfreeipa-19a0d51d89b640c04dc285067fc59b4a7fe9ca7f.tar.gz
freeipa-19a0d51d89b640c04dc285067fc59b4a7fe9ca7f.tar.xz
freeipa-19a0d51d89b640c04dc285067fc59b4a7fe9ca7f.zip
Use dosctrings in BeakerLib phase descriptions
Phase names are now in the format: test-module-TestClass-test_method: First line of docstring https://fedorahosted.org/freeipa/ticket/3723
Diffstat (limited to 'ipatests/beakerlib_plugin.py')
-rw-r--r--ipatests/beakerlib_plugin.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ipatests/beakerlib_plugin.py b/ipatests/beakerlib_plugin.py
index 770fced49..8857a2844 100644
--- a/ipatests/beakerlib_plugin.py
+++ b/ipatests/beakerlib_plugin.py
@@ -121,8 +121,15 @@ class BeakerLibPlugin(Plugin):
"""
if not isinstance(context, type):
return
- message = 'Nose Test Class: %s' % context.__name__
- self.run_beakerlib_command(['rlPhaseStart', 'FAIL', message])
+ try:
+ docstring = context.__doc__
+ caption = docstring.strip().partition('\n')[0]
+ except AttributeError:
+ docstring = ''
+ caption = 'Nose class (no docstring)'
+ phase_name = "%s-%s: %s" % (context.__module__.replace('.', '-'),
+ context.__name__, caption)
+ self.run_beakerlib_command(['rlPhaseStart', 'FAIL', phase_name])
self._in_class_setup = True
def stopContext(self, context):
@@ -137,8 +144,11 @@ class BeakerLibPlugin(Plugin):
if self._in_class_setup:
self.collect_logs(test.context)
self.log.info('Running test: %s', test.id())
- self.run_beakerlib_command(['rlPhaseStart', 'FAIL',
- 'Nose test: %s' % test])
+ caption = test.shortDescription()
+ if not caption:
+ caption = 'Nose method (no docstring)'
+ phase_name = "%s: %s" % (test.id().replace('.', '-'), caption)
+ self.run_beakerlib_command(['rlPhaseStart', 'FAIL', phase_name])
def stopTest(self, test):
"""End a test phase"""