[Zodb-checkins] CVS: ZODB4 - test.py:1.15

Jeremy Hylton jeremy@zope.com
Wed, 12 Mar 2003 18:32:53 -0500


Update of /cvs-repository/ZODB4
In directory cvs.zope.org:/tmp/cvs-serv544

Modified Files:
	test.py 
Log Message:
Start trace mode earlier in test, so that module imports are traced.


=== ZODB4/test.py 1.14 => 1.15 ===
--- ZODB4/test.py:1.14	Thu Mar  6 13:36:27 2003
+++ ZODB4/test.py	Wed Mar 12 18:32:52 2003
@@ -476,15 +476,6 @@
     elif LOOP:
         while True:
             runner(files, test_filter, debug)
-    elif TRACE:
-        coverdir = os.path.join(os.getcwd(), "coverage")
-        import trace
-        tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
-                             trace=0, count=1)
-        tracer.runctx("runner(files, test_filter, debug)",
-                      globals=globals(), locals=vars())
-        r = tracer.results()
-        r.write_results(show_missing=True, summary=True, coverdir=coverdir)
     else:
         runner(files, test_filter, debug)
 
@@ -631,9 +622,22 @@
             test_filter = args[1]
         module_filter = args[0]
     try:
-        bad = main(module_filter, test_filter, libdir)
-        if bad:
-            sys.exit(1)
+        if TRACE:
+            # if the trace module is used, then we don't exit with
+            # status if on a false return value from main.
+            coverdir = os.path.join(os.getcwd(), "coverage")
+            import trace
+            tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
+                                 trace=0, count=1)
+
+            tracer.runctx("main(module_filter, test_filter, libdir)",
+                          globals=globals(), locals=vars())
+            r = tracer.results()
+            r.write_results(show_missing=True, summary=True, coverdir=coverdir)
+        else:
+            bad = main(module_filter, test_filter, libdir)
+            if bad:
+                sys.exit(1)
     except ImportError, err:
         print err
         print sys.path