exit with status if main prog
authorrobin <robin@reportlab.com>
Tue, 20 Jun 2017 12:19:01 +0100
changeset 4364 2202f1517d21
parent 4363 fa1c8635929e
child 4365 1da75053d49c
exit with status if main prog
tests/runAll.py
--- a/tests/runAll.py	Fri May 26 09:21:13 2017 +0100
+++ b/tests/runAll.py	Tue Jun 20 12:19:01 2017 +0100
@@ -93,7 +93,9 @@
     cleanOnly = '--clean' in sys.argv
     if not cleanOnly:
         testSuite = makeSuite(folder,nonImportable=NI,pattern=pattern+(not haveSRC and 'c' or ''))
-        unittest.TextTestRunner().run(testSuite)
+        result = unittest.TextTestRunner().run(testSuite)
+    else:
+        result = None
 
     if haveSRC: cleanup(folder,patterns=('*.pyc','*.pyo'))
     if not cleanOnly:
@@ -102,6 +104,8 @@
             for f,tb in NI:
                 print('file: "%s"\n%s\n' % (f,''.join(tb)))
         printLocation()
+    if __name__=='__main__':
+        sys.exit(1 if result and not result.wasSuccessful() else 0)
 
 def mainEx():
     '''for use in subprocesses'''