[Zope-Checkins] CVS: Zope/utilities - testrunner.py:1.24

Chris Withers chrisw@nipltd.com
Tue, 29 Jan 2002 11:21:06 -0500


Update of /cvs-repository/Zope/utilities
In directory cvs.zope.org:/tmp/cvs-serv15109

Modified Files:
	testrunner.py 
Log Message:
Added option to output to a file to workaround M$ OSes' inability to pipe the standard error stream.

=== Zope/utilities/testrunner.py 1.23 => 1.24 ===
 
     def runSuite(self, suite):
-        runner=unittest.TextTestRunner(verbosity=self.verbosity)
+        runner=unittest.TextTestRunner(stream=sys.stderr, verbosity=self.verbosity)
         self.results.append(runner.run(suite))
 
     def report(self, message):
@@ -257,6 +257,11 @@
           whether it succeeded.  Running with -q is the same as
           running with -v1.
 
+       -o filename
+
+          Output test results to the specified file rather than
+          to stderr.
+
        -h
 
           Display usage information.
@@ -269,7 +274,7 @@
     mega_suite = 1
     set_python_path = 1
 
-    options, arg=getopt.getopt(args, 'amPhd:f:v:qM')
+    options, arg=getopt.getopt(args, 'amPhd:f:v:qMo:')
     if not options:
         err_exit(usage_msg)
     for name, value in options:
@@ -294,6 +299,9 @@
             verbosity = int(value)
         elif name == 'q':
             verbosity = 1
+        elif name == 'o':
+            f = open(value,'w')
+            sys.stderr = f
         else:
             err_exit(usage_msg)