[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/tests/test.py when a
test failure is encountered, generate a non-zero exit code;
Fred L. Drake, Jr.
fdrake at gmail.com
Fri Sep 3 02:07:23 EDT 2004
Log message for revision 27437:
when a test failure is encountered, generate a non-zero exit code;
this is needed so the BuildBot can report failures
Changed:
U Zope3/trunk/src/zope/app/tests/test.py
-=-
Modified: Zope3/trunk/src/zope/app/tests/test.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/test.py 2004-09-03 02:20:57 UTC (rev 27436)
+++ Zope3/trunk/src/zope/app/tests/test.py 2004-09-03 06:07:22 UTC (rev 27437)
@@ -473,7 +473,6 @@
self.cwd = os.getcwd()
sys.path.insert(0, os.path.join(self.cwd, self.libdir))
# Hack again for external products.
- global functional
kind = functional and "FUNCTIONAL" or "UNIT"
if libdir:
extra = os.path.join(self.org_cwd, libdir)
@@ -504,7 +503,6 @@
self._plen = len(prefix)
if not prefix.endswith(os.sep):
self._plen += 1
- global functional
if functional:
self.dirname = "ftests"
else:
@@ -792,7 +790,8 @@
if DEBUG:
print "Ran %s tests in debug mode" % run_debug(suite, VERBOSE)
- return
+ numbad = len(result.failures) + len(result.errors)
+ return numbad
r = runner.run(suite)
if TIMESFN:
@@ -801,6 +800,8 @@
print "Wrote timing data to", TIMESFN
if TIMETESTS:
r.print_times(sys.stdout, TIMETESTS)
+ numbad = len(result.failures) + len(result.errors)
+ return numbad
def remove_stale_bytecode(arg, dirname, names):
names = map(os.path.normcase, names)
@@ -840,7 +841,7 @@
from zope.app.tests.functional import FunctionalTestSetup
FunctionalTestSetup(config_file)
-
+ numbad = 0
if GUI:
gui_runner(files, test_filter)
elif LOOP:
@@ -854,11 +855,11 @@
print
print "Run %s:" % i
i += 1;
- runner(files, test_filter, DEBUG)
+ numbad = runner(files, test_filter, DEBUG)
gc.collect()
if gc.garbage:
print "GARBAGE:", len(gc.garbage), gc.garbage
- return
+ return numbad
if REFCOUNT:
prev = rc
@@ -866,9 +867,10 @@
print "totalrefcount=%-8d change=%-6d" % (rc, rc - prev)
track.update()
else:
- runner(files, test_filter, DEBUG)
+ numbad = runner(files, test_filter, DEBUG)
os.chdir(pathinit.org_cwd)
+ return numbad
def configure_logging():
@@ -1129,6 +1131,7 @@
k.append(True)
global functional
+ numbad = 0
for functional in k:
if VERBOSE:
@@ -1176,6 +1179,7 @@
ignoremods=ignoremods,
trace=False, count=True)
+ # we don't get the result from main() from runctx()
tracer.runctx("main(MODULE_FILTERS, TEST_FILTERS, LIBDIR)",
globals=globals(), locals=vars())
r = tracer.results()
@@ -1190,13 +1194,16 @@
else:
bad = main(MODULE_FILTERS, TEST_FILTERS, LIBDIR)
if bad:
- sys.exit(1)
+ numbad += bad
except ImportError, err:
print err
print sys.path
raise
+ if numbad:
+ sys.exit(1)
+
def test_suite():
"""Return an empty test suite to avoid complaints about this
module not having a 'test_suite' attribute."""
More information about the Zope3-Checkins
mailing list