MilesCranmer commited on
Commit
ad8ed14
1 Parent(s): dbb3f97

Fail job if unittest unsuccessful

Browse files
Files changed (1) hide show
  1. pysr/_cli/main.py +7 -1
pysr/_cli/main.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import unittest
2
  import warnings
3
 
@@ -79,4 +80,9 @@ def _tests(tests):
79
  for test_case in test_cases:
80
  suite.addTests(loader.loadTestsFromTestCase(test_case))
81
  runner = unittest.TextTestRunner()
82
- return runner.run(suite)
 
 
 
 
 
 
1
+ import sys
2
  import unittest
3
  import warnings
4
 
 
80
  for test_case in test_cases:
81
  suite.addTests(loader.loadTestsFromTestCase(test_case))
82
  runner = unittest.TextTestRunner()
83
+ results = runner.run(suite)
84
+ # Normally unittest would run this, but here we have
85
+ # to do it manually to get the exit code.
86
+
87
+ if not results.wasSuccessful():
88
+ sys.exit(1)