[Zpt] CVS: Packages/TAL - runtest.py:1.8

guido@digiciool.com guido@digiciool.com
Thu, 15 Mar 2001 12:36:56 -0500 (EST)


Update of /cvs-repository/Packages/TAL
In directory korak:/tmp/cvs-serv19491

Modified Files:
	runtest.py 
Log Message:
Catch exceptions and print traceback, then continue, rather than
stopping on the first exception.

Add -q option that supprresses most output (diffs and tracebacks).



--- Updated File runtest.py in package Packages/TAL --
--- runtest.py	2001/03/14 20:40:15	1.7
+++ runtest.py	2001/03/15 17:36:56	1.8
@@ -92,6 +92,7 @@
 import string
 from cStringIO import StringIO
 import glob
+import traceback
 
 import driver
 
@@ -116,6 +117,10 @@
 def main():
     opts = []
     args = sys.argv[1:]
+    quiet = 0
+    if args and args[0] == "-q":
+        quiet = 1
+        del args[0]
     while args and args[0][:1] == '-':
         opts.append(args[0])
         del args[0]
@@ -128,11 +133,18 @@
         sys.stdout.flush()
         save = sys.stdout, sys.argv
         try:
-            sys.stdout = stdout = StringIO()
-            sys.argv = [""] + opts + [arg]
-            driver.main()
-        finally:
-            sys.stdout, sys.argv = save
+            try:
+                sys.stdout = stdout = StringIO()
+                sys.argv = [""] + opts + [arg]
+                driver.main()
+            finally:
+                sys.stdout, sys.argv = save
+        except:
+            print sys.exc_type
+            errors = 1
+            if not quiet:
+                traceback.print_exc()
+            continue
         head, tail = os.path.split(arg)
         outfile = os.path.join(
             head,
@@ -155,7 +167,7 @@
         else:
             print "not OK"
             errors = 1
-            if expected is not None:
+            if not quiet and expected is not None:
                 showdiff(expected, actual)
     if errors:
         sys.exit(1)