[Zodb-checkins] CVS: StandaloneZODB - test.py:1.10.6.5

Guido van Rossum guido@python.org
Sun, 6 Jan 2002 09:55:20 -0500


Update of /cvs-repository/StandaloneZODB
In directory cvs.zope.org:/tmp/cvs-serv17130

Modified Files:
      Tag: Standby-branch
	test.py 
Log Message:
Exit with nonzero status when any test fails (except in -L mode).


=== StandaloneZODB/test.py 1.10.6.4 => 1.10.6.5 ===
     except Exception, e:
         print '%s skipped: %s' % (modname, e)
+        ##raise
         return None
     try:
         return mod.test_suite()
@@ -158,6 +159,9 @@
                     runner.run(suite)
                 gc.collect()
                 check_mem()
+        else:
+            print "No tests selected."
+            return 1
     else:
         runner = unittest.TextTestRunner(verbosity=VERBOSE)
         if MERGE_SUITES:
@@ -166,13 +170,17 @@
                 s = get_suite(file)
                 if s is not None:
                     suite.addTest(s)
-            runner.run(suite)
+            r = runner.run(suite)
+            return len(r.errors) + len(r.failures)
         else:
+            bad = 0
             for file in files:
                 suite = get_suite(file)
                 if suite is None:
                     continue
-                runner.run(suite)
+                r = runner.run(suite)
+                bad += len(r.errors) + len(r.failures)
+            return bad
 
 if __name__ == "__main__":
     import getopt
@@ -206,7 +214,9 @@
     if args:
         filter = args[0]
     try:
-        main(filter)
+        bad = main(filter)
+        if bad:
+            sys.exit(1)
     except ImportError, err:
         print err
         print sys.path