[Zope3-checkins]
SVN: zope.testing/trunk/src/zope/testing/testrunner
Fixed bug: couldn't use --package (aka -s, --dir) to select knit-in
Jim Fulton
jim at zope.com
Sun Oct 30 11:40:15 EST 2005
Log message for revision 39736:
Fixed bug: couldn't use --package (aka -s, --dir) to select knit-in
packages or subpackages of knit-in packages.
Changed:
A zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/
A zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/__init__.py
A zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/sampletests.py
U zope.testing/trunk/src/zope/testing/testrunner-knit.txt
U zope.testing/trunk/src/zope/testing/testrunner.py
-=-
Added: zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/__init__.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/__init__.py 2005-10-30 16:39:44 UTC (rev 39735)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/__init__.py 2005-10-30 16:40:15 UTC (rev 39736)
@@ -0,0 +1 @@
+#
Property changes on: zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/sampletests.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/sampletests.py 2005-10-30 16:39:44 UTC (rev 39735)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/sampletests.py 2005-10-30 16:40:15 UTC (rev 39736)
@@ -0,0 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+
+class Test(unittest.TestCase):
+
+ layer = 'samplelayers.Layer111'
+
+ def test_another_test_in_products(self):
+ pass
+
+def test_suite():
+ return unittest.makeSuite(Test)
Property changes on: zope.testing/trunk/src/zope/testing/testrunner-ex-pp-products/more/sampletests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: zope.testing/trunk/src/zope/testing/testrunner-knit.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-knit.txt 2005-10-30 16:39:44 UTC (rev 39735)
+++ zope.testing/trunk/src/zope/testing/testrunner-knit.txt 2005-10-30 16:40:15 UTC (rev 39736)
@@ -59,7 +59,8 @@
test_z1 (sampletests.test111)
testrunner-ex/sampletests/../sampletestsl.txt
test_extra_test_in_products (sample4.products.sampletests.Test)
- Ran 35 tests with 0 failures and 0 errors in 0.008 seconds.
+ test_another_test_in_products (sample4.products.more.sampletests.Test)
+ Ran 36 tests with 0 failures and 0 errors in 0.008 seconds.
Tearing down left over layers:
Tear down samplelayers.Layer111 in 0.000 seconds.
Tear down samplelayers.Layerx in 0.000 seconds.
@@ -67,4 +68,41 @@
Tear down samplelayers.Layer1 in 0.000 seconds.
In the example, the last test, test_extra_test_in_products, came from
-the products directory.
+the products directory. As usual, we can select the knit-in packages
+or individual packages within knit-in packages:
+
+ >>> sys.argv = 'test --package sample4.products -vv'.split()
+ >>> _ = testrunner.run(defaults)
+ Running tests at level 1
+ Running samplelayers.Layer111 tests:
+ Set up samplelayers.Layerx in 0.000 seconds.
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer11 in 0.000 seconds.
+ Set up samplelayers.Layer111 in 0.000 seconds.
+ Running:
+ test_extra_test_in_products (sample4.products.sampletests.Test)
+ test_another_test_in_products (sample4.products.more.sampletests.Test)
+ Ran 2 tests with 0 failures and 0 errors in 0.000 seconds.
+ Tearing down left over layers:
+ Tear down samplelayers.Layer111 in 0.000 seconds.
+ Tear down samplelayers.Layerx in 0.000 seconds.
+ Tear down samplelayers.Layer11 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
+
+ >>> sys.argv = 'test --package sample4.products.more -vv'.split()
+ >>> _ = testrunner.run(defaults)
+ Running tests at level 1
+ Running samplelayers.Layer111 tests:
+ Set up samplelayers.Layerx in 0.000 seconds.
+ Set up samplelayers.Layer1 in 0.000 seconds.
+ Set up samplelayers.Layer11 in 0.000 seconds.
+ Set up samplelayers.Layer111 in 0.000 seconds.
+ Running:
+ test_another_test_in_products (sample4.products.more.sampletests.Test)
+ Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
+ Tearing down left over layers:
+ Tear down samplelayers.Layer111 in 0.000 seconds.
+ Tear down samplelayers.Layerx in 0.000 seconds.
+ Tear down samplelayers.Layer11 in 0.000 seconds.
+ Tear down samplelayers.Layer1 in 0.000 seconds.
+
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py 2005-10-30 16:39:44 UTC (rev 39735)
+++ zope.testing/trunk/src/zope/testing/testrunner.py 2005-10-30 16:40:15 UTC (rev 39736)
@@ -864,8 +864,8 @@
def find_suites(options):
for fpath, package in find_test_files(options):
- for prefix in options.prefix:
- if fpath.startswith(prefix):
+ for (prefix, prefix_package) in options.prefix:
+ if fpath.startswith(prefix) and package == prefix_package:
# strip prefix, strip .py suffix and convert separator to dots
noprefix = fpath[len(prefix):]
noext = strip_py_ext(options, noprefix)
@@ -1014,10 +1014,10 @@
p = os.path.abspath(p)
if p in seen:
continue
- for prefix in options.prefix:
- if p.startswith(prefix):
+ for (prefix, package) in options.prefix:
+ if p.startswith(prefix) or p == prefix[:-1]:
seen[p] = 1
- yield p, ''
+ yield p, package
break
else:
for dpath in options.test_path:
@@ -1581,7 +1581,8 @@
])
- options.prefix = [p + os.path.sep for (p, _) in options.test_path]
+ options.prefix = [(path + os.path.sep, package)
+ for (path, package) in options.test_path]
if options.all:
options.at_level = sys.maxint
More information about the Zope3-Checkins
mailing list