runAll.py: add support for external running
authorrgbecker
Sun, 21 May 2006 09:12:50 +0000
changeset 2626 4376a2bdc5c8
parent 2625 71abbda1f58c
child 2627 a9d291175b81
runAll.py: add support for external running
reportlab/test/runAll.py
--- a/reportlab/test/runAll.py	Fri May 19 14:16:02 2006 +0000
+++ b/reportlab/test/runAll.py	Sun May 21 09:12:50 2006 +0000
@@ -68,5 +68,26 @@
                 print 'file: "%s"\n%s\n' % (f,string.join(tb,''))
         printLocation()
 
+def mainEx():
+    '''for use in subprocesses'''
+    try:
+        main()
+    finally:
+        sys.stdout.flush()
+        sys.stderr.flush()
+        sys.stdout.close()
+        os.close(sys.stderr.fileno())
+
+def runExternally():
+    cmd = sys.executable+' -c"from reportlab.test import runAll;runAll.mainEx()"'
+    i,o,e=os.popen3(cmd)
+    i.close()
+    out = o.read()
+    err=e.read()
+    return '\n'.join((out,err))
+
+def checkForFailure(outerr):
+    return '\nFAILED' in outerr
+
 if __name__ == '__main__': #noruntests
     main()