[Zope3-checkins] SVN: zope.testing/trunk/ Fix #251759: Test runner descended into directories that aren't Python

Christian Theune ct at gocept.com
Sat Jul 4 06:23:50 EDT 2009


Log message for revision 101495:
  Fix #251759: Test runner descended into directories that aren't Python
  packages.
  

Changed:
  U   zope.testing/trunk/CHANGES.txt
  U   zope.testing/trunk/src/zope/testing/testrunner/find.py
  U   zope.testing/trunk/src/zope/testing/testrunner/testrunner-edge-cases.txt
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/__init__.py
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/bar/
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/bar/__init__.py
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/bar/tests.py
  A   zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/test.py

-=-
Modified: zope.testing/trunk/CHANGES.txt
===================================================================
--- zope.testing/trunk/CHANGES.txt	2009-07-04 10:23:22 UTC (rev 101494)
+++ zope.testing/trunk/CHANGES.txt	2009-07-04 10:23:50 UTC (rev 101495)
@@ -4,6 +4,9 @@
 3.7.7 (unreleased)
 ==================
 
+- Fix #251759: Test runner descended into directories that aren't Python
+  packages.
+
 - Code cleanups.
 
 

Modified: zope.testing/trunk/src/zope/testing/testrunner/find.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/find.py	2009-07-04 10:23:22 UTC (rev 101494)
+++ zope.testing/trunk/src/zope/testing/testrunner/find.py	2009-07-04 10:23:50 UTC (rev 101495)
@@ -204,7 +204,10 @@
     for (p, package) in test_dirs(options, {}):
         for dirname, dirs, files in walk_with_symlinks(options, p):
             if dirname != p and not contains_init_py(options, files):
-                continue    # not a plausible test directory
+                # This is not a plausible test directory. Avoid descending
+                # further.
+                del dirs[:]
+                continue
             root2ext = {}
             dirs[:] = filter(identifier, dirs)
             d = os.path.split(dirname)[1]

Modified: zope.testing/trunk/src/zope/testing/testrunner/testrunner-edge-cases.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner/testrunner-edge-cases.txt	2009-07-04 10:23:22 UTC (rev 101494)
+++ zope.testing/trunk/src/zope/testing/testrunner/testrunner-edge-cases.txt	2009-07-04 10:23:50 UTC (rev 101495)
@@ -50,9 +50,28 @@
     Total: 405 tests, 0 failures, 0 errors in N.NNN seconds.
     False
 
+Bug #251759: The test runner's protection against descending into non-package
+directories was ineffective, e.g. picking up tests from eggs that were stored
+close by:
+
+    >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex-251759')
+
+    >>> defaults = [
+    ...     '--test-path', directory_with_tests,
+    ...     ]
+    >>> testrunner.run_internal(defaults)
+    Total: 0 tests, 0 failures, 0 errors in 0.000 seconds.
+    False
+
+
 Debugging Edge Cases
 --------------------
 
+    >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
+    >>> defaults = [
+    ...     '--test-path', directory_with_tests,
+    ...     '--tests-pattern', '^sampletestsf?$',
+    ...     ]
     >>> class Input:
     ...     def __init__(self, src):
     ...         self.lines = src.split('\n')
@@ -483,3 +502,4 @@
             option.
     <BLANKLINE>
     True
+


Property changes on: zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/bar/__init__.py
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/foo/bar/tests.py
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: zope.testing/trunk/src/zope/testing/testrunner/testrunner-ex-251759/eggs/foo.bar-1.2-py2.5.egg/test.py
___________________________________________________________________
Added: svn:eol-style
   + native



More information about the Zope3-Checkins mailing list