Commit 4218166fa3f04528e22161dc716141771708e3be
1 parent
9502ac30
Raise an exception instead of exiting with a non-zero return code in the unit tests (#1983)
Showing
4 changed files
with
14 additions
and
6 deletions
test/test_ctbin.py
| @@ -87,7 +87,8 @@ class Test(test): | @@ -87,7 +87,8 @@ class Test(test): | ||
| 87 | 87 | ||
| 88 | # Load counts cube and check content. | 88 | # Load counts cube and check content. |
| 89 | evt = gammalib.GCTAEventCube('cntmap_cmd1.fits') | 89 | evt = gammalib.GCTAEventCube('cntmap_cmd1.fits') |
| 90 | - self._check_cube(evt, 5542) | 90 | + #JKself._check_cube(evt, 5542) |
| 91 | + self._check_cube(evt, 5543) | ||
| 91 | 92 | ||
| 92 | # Setup ctbin command | 93 | # Setup ctbin command |
| 93 | cmd = ctbin+' inobs="events_that_do_not_exist.fits"'+ \ | 94 | cmd = ctbin+' inobs="events_that_do_not_exist.fits"'+ \ |
test/test_examples.py.in
| @@ -487,7 +487,8 @@ class Test(gammalib.GPythonTestSuite): | @@ -487,7 +487,8 @@ class Test(gammalib.GPythonTestSuite): | ||
| 487 | args = '-p example_show_pointings.eps %s/obs_unbinned.xml' % self._datadir | 487 | args = '-p example_show_pointings.eps %s/obs_unbinned.xml' % self._datadir |
| 488 | 488 | ||
| 489 | # Execute script | 489 | # Execute script |
| 490 | - self._execute_python('show_pointings', args=args) | 490 | + #JKself._execute_python('show_pointings', args=args) |
| 491 | + self._execute_python('show_pointing', args=args) | ||
| 491 | 492 | ||
| 492 | # Return | 493 | # Return |
| 493 | return | 494 | return |
| @@ -533,4 +534,6 @@ if __name__ == '__main__': | @@ -533,4 +534,6 @@ if __name__ == '__main__': | ||
| 533 | rc = 1 | 534 | rc = 1 |
| 534 | 535 | ||
| 535 | # Exit with return code | 536 | # Exit with return code |
| 536 | - sys.exit(rc) | 537 | + if not success: |
| 538 | + raise RuntimeError('At least one error occured during the test.') | ||
| 539 | + #sys.exit(rc) |
test/test_python_cscripts.py
| @@ -185,7 +185,9 @@ def test(installed=False, debug=False): | @@ -185,7 +185,9 @@ def test(installed=False, debug=False): | ||
| 185 | os.system('rm -rf %s' % (path)) | 185 | os.system('rm -rf %s' % (path)) |
| 186 | 186 | ||
| 187 | # Exit with return code | 187 | # Exit with return code |
| 188 | - sys.exit(rc) | 188 | + if not success: |
| 189 | + raise RuntimeError('At least one error occured during the test.') | ||
| 190 | + #sys.exit(rc) | ||
| 189 | 191 | ||
| 190 | 192 | ||
| 191 | # ======================== # | 193 | # ======================== # |
test/test_python_ctools.py
| @@ -143,8 +143,10 @@ def test(installed=False): | @@ -143,8 +143,10 @@ def test(installed=False): | ||
| 143 | if installed: | 143 | if installed: |
| 144 | os.system('rm -rf %s' % (path)) | 144 | os.system('rm -rf %s' % (path)) |
| 145 | 145 | ||
| 146 | - # Exit with return code | ||
| 147 | - sys.exit(rc) | 146 | + # Throw an exception in case of failure |
| 147 | + if not success: | ||
| 148 | + raise RuntimeError('At least one error occured during the test.') | ||
| 149 | + #sys.exit(rc) | ||
| 148 | 150 | ||
| 149 | 151 | ||
| 150 | # ======================== # | 152 | # ======================== # |