[Zope3-checkins]
SVN: zope.testing/trunk/src/zope/testing/testrunner
Added logic to make sure that, when looking for tests, we don't
Jim Fulton
jim at zope.com
Sat Jun 25 08:34:33 EDT 2005
Log message for revision 30919:
Added logic to make sure that, when looking for tests, we don't
descend into non packages.
Changed:
A zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/
A zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/sampletests.py
A zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/
A zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/sampletests.py
U zope.testing/trunk/src/zope/testing/testrunner.py
-=-
Added: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/sampletests.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/sampletests.py 2005-06-25 11:57:37 UTC (rev 30918)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/sampletests.py 2005-06-25 12:34:33 UTC (rev 30919)
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# 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
+
+def f():
+ g()
+
+def g():
+ x = 1
+ x = x + 1
+ x = y + 1
+ x = x + 1
+
+
+def eek(self):
+ """
+ >>> f()
+ 1
+ """
+
+class Test(unittest.TestCase):
+
+ def test1(self):
+ pass
+
+ def test2(self):
+ pass
+
+ def test3(self):
+ f()
+
+ def test4(self):
+ pass
+
+ def test5(self):
+ pass
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(doctest.DocTestSuite())
+ suite.addTest(unittest.makeSuite(Test))
+ suite.addTest(doctest.DocFileSuite('e.txt'))
+ return suite
Property changes on: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/do-not-enter/sampletests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/sampletests.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/sampletests.py 2005-06-25 11:57:37 UTC (rev 30918)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/sampletests.py 2005-06-25 12:34:33 UTC (rev 30919)
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# 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
+
+def f():
+ g()
+
+def g():
+ x = 1
+ x = x + 1
+ x = y + 1
+ x = x + 1
+
+
+def eek(self):
+ """
+ >>> f()
+ 1
+ """
+
+class Test(unittest.TestCase):
+
+ def test1(self):
+ pass
+
+ def test2(self):
+ pass
+
+ def test3(self):
+ f()
+
+ def test4(self):
+ pass
+
+ def test5(self):
+ pass
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(doctest.DocTestSuite())
+ suite.addTest(unittest.makeSuite(Test))
+ suite.addTest(doctest.DocFileSuite('e.txt'))
+ return suite
Property changes on: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/donotenter/sampletests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py 2005-06-25 11:57:37 UTC (rev 30918)
+++ zope.testing/trunk/src/zope/testing/testrunner.py 2005-06-25 12:34:33 UTC (rev 30919)
@@ -479,11 +479,15 @@
yield f
break
+identifier = re.compile('^[_a-zA-Z][_a-zA-Z0-9]+$').match
def find_test_files_(options):
tests_pattern = options.tests_pattern
test_file_pattern = options.test_file_pattern
for p in test_dirs(options, {}):
for dirname, dirs, files in walk_with_symlinks(options, p):
+ if (dirname != p) and ('__init__.py' not in files):
+ continue
+ dirs[:] = filter(identifier, dirs)
d = os.path.split(dirname)[1]
if tests_pattern(d) and ('__init__.py' in files):
# tests directory
More information about the Zope3-Checkins
mailing list