Commit 1aa1a2c66fae892ae982b0d2f5278d3ac3b0d0c9
Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into 1982-a…
…dd-phase-info-ctphase
Showing
6 changed files
with
19 additions
and
13 deletions
ChangeLog
| 1 | -2017-03-28 | 1 | +2017-04-04 |
| 2 | 2 | ||
| 3 | * Version 1.3.0 released | 3 | * Version 1.3.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Raise exception instead of exiting with return code in Python tests (#1983) | ||
| 6 | Support of map cubes lying outside RoI in ctobssim | 7 | Support of map cubes lying outside RoI in ctobssim |
| 7 | Support energy boundary FITS file in ctmapcube (#1978) | 8 | Support energy boundary FITS file in ctmapcube (#1978) |
| 8 | Add csebins script (#1976) | 9 | Add csebins script (#1976) |
NEWS
| 1 | New Features and Important Changes in ctools 1.3.0.dev1 | 1 | New Features and Important Changes in ctools 1.3.0.dev1 |
| 2 | 2 | ||
| 3 | -28 March 2017 | 3 | +4 April 2017 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -11,7 +11,9 @@ ctools release with respect to the precedent release. | @@ -11,7 +11,9 @@ ctools release with respect to the precedent release. | ||
| 11 | 11 | ||
| 12 | Configuration | 12 | Configuration |
| 13 | ------------- | 13 | ------------- |
| 14 | -None | 14 | +The Python unit tests now raise exceptions instead of exiting with a non- |
| 15 | +zero return code so that the user is not thrown out of Python after calling | ||
| 16 | +ctools.test() and cscripts.test() (#1983). | ||
| 15 | 17 | ||
| 16 | 18 | ||
| 17 | Python interface | 19 | Python interface |
test/test_ctbin.py
| @@ -30,7 +30,7 @@ from testing import test | @@ -30,7 +30,7 @@ from testing import test | ||
| 30 | class Test(test): | 30 | class Test(test): |
| 31 | """ | 31 | """ |
| 32 | Test class for ctbin tool | 32 | Test class for ctbin tool |
| 33 | - | 33 | + |
| 34 | This test class makes unit tests for the ctbin tool by using it from | 34 | This test class makes unit tests for the ctbin tool by using it from |
| 35 | the command line and from Python. | 35 | the command line and from Python. |
| 36 | """ | 36 | """ |
| @@ -280,7 +280,7 @@ class Test(test): | @@ -280,7 +280,7 @@ class Test(test): | ||
| 280 | def _check_observation(self, ctbin, nevents, multiplier=1): | 280 | def _check_observation(self, ctbin, nevents, multiplier=1): |
| 281 | """ | 281 | """ |
| 282 | Check content of an observation | 282 | Check content of an observation |
| 283 | - | 283 | + |
| 284 | Parameters | 284 | Parameters |
| 285 | ---------- | 285 | ---------- |
| 286 | ctbin : `~ctools.ctbin` | 286 | ctbin : `~ctools.ctbin` |
| @@ -316,7 +316,7 @@ class Test(test): | @@ -316,7 +316,7 @@ class Test(test): | ||
| 316 | def _check_cube(self, cube, nevents, multiplier=1): | 316 | def _check_cube(self, cube, nevents, multiplier=1): |
| 317 | """ | 317 | """ |
| 318 | Check content of event cube | 318 | Check content of event cube |
| 319 | - | 319 | + |
| 320 | Parameters | 320 | Parameters |
| 321 | ---------- | 321 | ---------- |
| 322 | cube : `~gammalib.GCTAEventCube` | 322 | cube : `~gammalib.GCTAEventCube` |
test/test_examples.py.in
| @@ -532,5 +532,6 @@ if __name__ == '__main__': | @@ -532,5 +532,6 @@ if __name__ == '__main__': | ||
| 532 | else: | 532 | else: |
| 533 | rc = 1 | 533 | rc = 1 |
| 534 | 534 | ||
| 535 | - # Exit with return code | ||
| 536 | - sys.exit(rc) | 535 | + # Raise an exception in case of failure |
| 536 | + if not success: | ||
| 537 | + raise RuntimeError('At least one error occured during the test.') |
test/test_python_cscripts.py
| @@ -184,8 +184,9 @@ def test(installed=False, debug=False): | @@ -184,8 +184,9 @@ def test(installed=False, debug=False): | ||
| 184 | if installed: | 184 | if installed: |
| 185 | os.system('rm -rf %s' % (path)) | 185 | os.system('rm -rf %s' % (path)) |
| 186 | 186 | ||
| 187 | - # Exit with return code | ||
| 188 | - sys.exit(rc) | 187 | + # Raise an exception in case of failure |
| 188 | + if not success: | ||
| 189 | + raise RuntimeError('At least one error occured during the test.') | ||
| 189 | 190 | ||
| 190 | 191 | ||
| 191 | # ======================== # | 192 | # ======================== # |
test/test_python_ctools.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctools package | 3 | # This scripts performs unit tests for the ctools package |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2012-2016 Juergen Knoedlseder | 5 | +# Copyright (C) 2012-2017 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -143,8 +143,9 @@ def test(installed=False): | @@ -143,8 +143,9 @@ 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 | + # Raise an exception in case of failure |
| 147 | + if not success: | ||
| 148 | + raise RuntimeError('At least one error occured during the test.') | ||
| 148 | 149 | ||
| 149 | 150 | ||
| 150 | # ======================== # | 151 | # ======================== # |