mailr23360 - in /trunk/test_suite: relax_test_runner.py test_suite_runner.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 22, 2014 - 19:39:
Author: bugman
Date: Thu May 22 19:39:22 2014
New Revision: 23360

URL: http://svn.gna.org/viewcvs/relax?rev=23360&view=rev
Log:
Improvement for the unit test printouts when run with the --time command line 
option.

The full unit test name is now printed out, reverting to the old behaviour 
(prior to r21965).
However the shortened test names are preserved for the other test suite 
categories.


Modified:
    trunk/test_suite/relax_test_runner.py
    trunk/test_suite/test_suite_runner.py

Modified: trunk/test_suite/relax_test_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/relax_test_runner.py?rev=23360&r1=23359&r2=23360&view=diff
==============================================================================
--- trunk/test_suite/relax_test_runner.py       (original)
+++ trunk/test_suite/relax_test_runner.py       Thu May 22 19:39:22 2014
@@ -40,18 +40,21 @@
     prepend the output to the failure and error reports normally generated 
by TextTestRunner.
     """
 
-    def __init__(self, stream, descriptions, verbosity, timing=False):
+    def __init__(self, stream, descriptions, verbosity, timing=False, 
category=None):
         """Initialise the RelaxTestResult object with relax specific 
variables.
 
         @keyword timing:    A flag which if True will enable timing of 
individual tests.
         @type timing:       bool
+        @keyword category:  The type of test being performed, to allow the 
printouts to be changed.  This can be one of 'system', 'unit', 'gui', or 
'verification'. the printout.
+        @type category:     str
         """
 
         # Normal setup.
         super(RelaxTestResult, self).__init__(stream, descriptions, 
verbosity)
 
-        # Store the timing flag.
+        # Store the timing flag and category.
         self.timing_flag = timing
+        self.category = category
 
 
     def addError(self, test, err):
@@ -164,8 +167,9 @@
         self.time -= time()
 
         # Change the test name.
-        test_name = test_name.split('.')
-        test_name = "%s.%s" % (test_name[-2], test_name[-1])
+        if self.category != 'unit':
+            test_name = test_name.split('.')
+            test_name = "%s.%s" % (test_name[-2], test_name[-1])
 
         # The printout.
         self.stream.write('  %7.2f s for %s\n' % (-self.time, test_name))
@@ -195,6 +199,9 @@
     This runner is designed to catch STDOUT during the execution of each 
test and to prepend the
     output to the failure and error reports normally generated by 
TextTestRunner.
     """
+
+    # Variable for specifying the type of test being performed, to change 
the printout.
+    category = None
 
     def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1, 
failfast=False, buffer=False, resultclass=None, timing=False):
         """Initialise the class, storing the timing flag.
@@ -216,7 +223,7 @@
     def _makeResult(self):
         """Override of the TextTestRunner._makeResult() method."""
 
-        return RelaxTestResult(self.stream, self.descriptions, 
self.verbosity, timing=self.timing_flag)
+        return RelaxTestResult(self.stream, self.descriptions, 
self.verbosity, timing=self.timing_flag, category=self.category)
 
 
 

Modified: trunk/test_suite/test_suite_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/test_suite_runner.py?rev=23360&r1=23359&r2=23360&view=diff
==============================================================================
--- trunk/test_suite/test_suite_runner.py       (original)
+++ trunk/test_suite/test_suite_runner.py       Thu May 22 19:39:22 2014
@@ -134,6 +134,7 @@
 
             # Execute the GUI tests.
             gui_runner = GUI_test_runner()
+            self.runner.category = 'gui'
             self.gui_result = gui_runner.run(self.tests, runner=self.runner)
 
             # Clean up for the GUI, if not in GUI mode.
@@ -167,6 +168,7 @@
 
         # Run the tests.
         system_runner = System_test_runner()
+        self.runner.category = 'system'
         self.system_result = system_runner.run(self.tests, 
runner=self.runner)
 
         # Print out a summary of the test suite.
@@ -186,6 +188,7 @@
 
         # Run the tests.
         unit_runner = 
Unit_test_runner(root_path=status.install_path+os.sep+'test_suite'+os.sep+'unit_tests')
+        self.runner.category = 'unit'
         self.unit_result = unit_runner.run(runner=self.runner)
 
         # Print out a summary of the test suite.
@@ -205,6 +208,7 @@
 
         # Run the tests.
         verification_runner = Verification_test_runner()
+        self.runner.category = 'verification'
         self.verification_result = verification_runner.run(self.tests, 
runner=self.runner)
 
         # Print out a summary of the test suite.




Related Messages


Powered by MHonArc, Updated Thu May 22 19:40:02 2014