Browse Source

Added non-zero exit code for errors/failures during tests.

Sander Mathijs van Veen 14 năm trước cách đây
mục cha
commit
f3e2921dea
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      runner.py

+ 6 - 1
runner.py

@@ -145,4 +145,9 @@ def main(tests, verbose=0, color=True):
     runner = TextTestRunner(verbosity=verbose, color=color)
     suite = unittest.TestSuite(testcases)
     suite.filename = testfile
-    runner.run(suite)
+
+    result = runner.run(suite)
+
+    # Return non zero exit code if there are failures or errors occured.
+    if result.failures or result.errors:
+        sys.exit(1)