[Zope3-checkins] CVS: Zope3 - test.py:1.83.2.1
ftesting.zcml:1.19.2.1
Philipp von Weitershausen
philikon at philikon.de
Mon Feb 23 12:50:56 EST 2004
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv29751
Modified Files:
Tag: philikon-movecontent-branch
test.py ftesting.zcml
Log Message:
Merge essential bugfixes from HEAD in order to make functional tests pass.
=== Zope3/test.py 1.83 => 1.83.2.1 ===
--- Zope3/test.py:1.83 Wed Jan 21 10:41:59 2004
+++ Zope3/test.py Mon Feb 23 12:50:56 2004
@@ -44,8 +44,10 @@
test, so Use With Care.
--dir directory
- Option to limit where tests are searched for. This is
- important when you *really* want to limit the code that gets run.
+ Option to limit where tests are searched for. This is important
+ when you *really* want to limit the code that gets run. This can
+ be specified more than once to run tests in two different parts of
+ the source tree.
For example, if refactoring interfaces, you don't want to see the way
you have broken setups for tests in other packages. You *just* want to
run the interface tests.
@@ -174,6 +176,13 @@
import unittest
import warnings
+def set_trace_doctest(stdin=sys.stdin, stdout=sys.stdout, trace=pdb.set_trace):
+ sys.stdin = stdin
+ sys.stdout = stdout
+ trace()
+
+pdb.set_trace_doctest = set_trace_doctest
+
from distutils.util import get_platform
PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
@@ -421,9 +430,10 @@
def visit(self, rx, dir, files):
if os.path.split(dir)[1] != self.dirname:
- # Allow tests module rather than package.
- if "tests.py" in files:
- path = os.path.join(dir, "tests.py")
+ # Allow tests/ftests module rather than package.
+ modfname = self.dirname + '.py'
+ if modfname in files:
+ path = os.path.join(dir, modfname)
if match(rx, path):
self.files.append(path)
return
@@ -483,30 +493,27 @@
if os.path.isdir(name):
walk_with_symlinks(name, func, arg)
-
-def check_test_dir():
- global test_dir
- if test_dir and not os.path.exists(test_dir):
- d = pathinit.libdir
- d = os.path.join(d, test_dir)
- if os.path.exists(d):
- if not os.path.isdir(d):
- raise ValueError(
- "%s does not exist and %s is not a directory"
- % (test_dir, d)
- )
- test_dir = d
- else:
- raise ValueError("%s does not exist!" % test_dir)
-
+def find_test_dir(dir):
+ if os.path.exists(dir):
+ return dir
+ d = os.path.join(pathinit.libdir, dir)
+ if os.path.exists(d):
+ if os.path.isdir(d):
+ return d
+ raise ValueError("%s does not exist and %s is not a directory"
+ % (dir, d))
+ raise ValueError("%s does not exist!" % dir)
def find_tests(rx):
global finder
finder = TestFileFinder(pathinit.libdir)
- check_test_dir()
- walkdir = test_dir or pathinit.libdir
- walk_with_symlinks(walkdir, finder.visit, rx)
+ if test_dirs:
+ for d in test_dirs:
+ d = find_test_dir(d)
+ walk_with_symlinks(d, finder.visit, rx)
+ else:
+ walk_with_symlinks(pathinit.libdir, finder.visit, rx)
return finder.files
def package_import(modname):
@@ -719,7 +726,7 @@
global progress
global build_inplace
global keepStaleBytecode
- global test_dir
+ global test_dirs
global profile
if argv is None:
@@ -746,7 +753,7 @@
timetests = 0
keepStaleBytecode = 0
kinds = 'unit'
- test_dir = None
+ test_dirs = []
profile = False
try:
@@ -825,7 +832,7 @@
# must be a filename to write
timesfn = v
elif k == '--dir':
- test_dir = v
+ test_dirs.append(v)
if sys.version_info < ( 2,3,2 ):
print """\
=== Zope3/ftesting.zcml 1.19 => 1.19.2.1 ===
--- Zope3/ftesting.zcml:1.19 Wed Jan 28 12:02:46 2004
+++ Zope3/ftesting.zcml Mon Feb 23 12:50:56 2004
@@ -5,7 +5,7 @@
<!-- used for functional testing setup -->
<include package="zope.app" />
- <include file="products.zcml" />
+ <include file="products_ftesting.zcml" />
<!-- Principals -->
@@ -21,7 +21,6 @@
<grant role="zope.Manager" principal="zope.mgr" />
- <include file="products_ftesting.zcml" />
<includeOverrides file="overrides_ftesting.zcml" />
</configure>
More information about the Zope3-Checkins
mailing list