← Back to team overview

yellow team mailing list archive

[Merge] lp:~bac/zope.testing/list-tests into lp:~launchpad/zope.testing/3.9.4-fork

 

Brad Crittenden has proposed merging lp:~bac/zope.testing/list-tests into lp:~launchpad/zope.testing/3.9.4-fork.

Requested reviews:
  Yellow Squad (yellow)
Related bugs:
  Bug #682772 in Launchpad itself: "doctest construction generates duplicate test ids"
  https://bugs.launchpad.net/launchpad/+bug/682772

For more details, see:
https://code.launchpad.net/~bac/zope.testing/list-tests/+merge/109007

In Launchpad, some doctests are registered multiple times using different layers, etc. To the test runner they appear the same as they have the same id. Launchpad now gives them different ids but they still reference the same path, which is what the testrunner uses to report and discover tests.

This change causes the testrunner to output test.id() instead of str(test). It also allows tests to be discovered by pattern matching against the id property.
-- 
https://code.launchpad.net/~bac/zope.testing/list-tests/+merge/109007
Your team Yellow Squad is requested to review the proposed merge of lp:~bac/zope.testing/list-tests into lp:~launchpad/zope.testing/3.9.4-fork.
=== modified file 'setup.py'
--- setup.py	2012-05-30 11:59:41 +0000
+++ setup.py	2012-06-06 17:53:32 +0000
@@ -85,7 +85,7 @@
 
 setup(
     name='zope.testing',
-    version = '3.9.4-p6',
+    version = '3.9.4-p8',
     url='http://pypi.python.org/pypi/zope.testing',
     license='ZPL 2.1',
     description='Zope testing framework, including the testrunner script.',

=== modified file 'src/zope/testing/testrunner/find.py'
--- src/zope/testing/testrunner/find.py	2010-06-04 14:58:44 +0000
+++ src/zope/testing/testrunner/find.py	2012-06-06 17:53:32 +0000
@@ -34,10 +34,10 @@
     >>> class Options(object):
     ...    post_mortem = False
     >>> options = Options()
-    
+
     Normally the StartUpFailure just acts as an empty test suite to satisfy
     the test runner and statistics:
-    
+
     >>> s = StartUpFailure(options, None, None)
     >>> isinstance(s,unittest.TestCase)
     True
@@ -48,9 +48,9 @@
 
     ...then the the StartUpFailure will start the debugger and stop
     the test run after the debugger quits.
-    
+
     To simulate this, we need an exception and its associated
-    exc_info: 
+    exc_info:
 
     >>> import sys
     >>> try:
@@ -60,7 +60,7 @@
 
     To simulate the user pressing 'c' and hitting return in the
     debugger, we use a FakeInputContinueGenerator:
-    
+
     >>> from zope.testing.testrunner.runner import FakeInputContinueGenerator
     >>> old_stdin = sys.stdin
     >>> sys.stdin = FakeInputContinueGenerator()
@@ -68,7 +68,7 @@
     Now we can see the EndRun exception that is raised by the
     postmortem debugger to indicate that debugging is finished and the
     test run should be terminated:
-    
+
     >>> try:
     ...     StartUpFailure(options, None, exc_info)
     ... finally:
@@ -362,7 +362,7 @@
     else:
         if level <= options.at_level:
             for pat in options.test:
-                if pat(str(suite)):
+                if pat(str(suite)) or pat(suite.id()):
                     yield (suite, layer)
                     break
 

=== modified file 'src/zope/testing/testrunner/formatter.py'
--- src/zope/testing/testrunner/formatter.py	2012-05-30 11:59:41 +0000
+++ src/zope/testing/testrunner/formatter.py	2012-06-06 17:53:32 +0000
@@ -175,7 +175,7 @@
         """Report a list of test names."""
         print "Listing %s tests:" % layer_name
         for test in tests:
-            print ' ', test
+            print ' ', test.id()
 
     def garbage(self, garbage):
         """Report garbage generated by tests."""
@@ -278,7 +278,7 @@
             sys.stdout.write('\n')
 
         if self.verbose > 1:
-            s = str(test)
+            s = str(test.id())
             sys.stdout.write(' ')
             sys.stdout.write(s)
             self.test_width += len(s) + 1

=== modified file 'src/zope/testing/testrunner/listing.py'
--- src/zope/testing/testrunner/listing.py	2010-06-04 14:58:44 +0000
+++ src/zope/testing/testrunner/listing.py	2012-06-06 17:53:32 +0000
@@ -31,6 +31,5 @@
         self.runner.failed = False
 
     def report(self):
-        layers = self.runner.tests_by_layer_name
         for layer_name, layer, tests in self.runner.ordered_layers():
             self.runner.options.output.list_of_tests(tests, layer_name)