Commit d7c71736d5adc40b323e65a64087786c3c050186
1 parent
27087654
In case of an error, test output is now written into log file (#2264).
Showing
52 changed files
with
156 additions
and
295 deletions
ChangeLog
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | Support On/Off analysis in cslightcrv and csphasecrv (#2273) | 13 | Support On/Off analysis in cslightcrv and csphasecrv (#2273) |
| 14 | ctselect informs about non-overlapping time interval (#2272) | 14 | ctselect informs about non-overlapping time interval (#2272) |
| 15 | Add tutorial for classical analysis (#2267) | 15 | Add tutorial for classical analysis (#2267) |
| 16 | + In case of an error, test output is now written into log file (#2264) | ||
| 16 | Fix chatter level handling in ctpsfcube (#2262) | 17 | Fix chatter level handling in ctpsfcube (#2262) |
| 17 | Handle On/Off observations by cspull (#2260) | 18 | Handle On/Off observations by cspull (#2260) |
| 18 | Add "statistic" parameter to all likelihood tools and scripts (#2237) | 19 | Add "statistic" parameter to all likelihood tools and scripts (#2237) |
NEWS
| @@ -9,6 +9,8 @@ ctools release with respect to the precedent release. | @@ -9,6 +9,8 @@ ctools release with respect to the precedent release. | ||
| 9 | 9 | ||
| 10 | Configuration | 10 | Configuration |
| 11 | ------------- | 11 | ------------- |
| 12 | +In case of an error, test output is now written into log file (#2264). | ||
| 13 | + | ||
| 12 | The cscripts::execute() method no longer creates log files, making the | 14 | The cscripts::execute() method no longer creates log files, making the |
| 13 | cscripts behaviour compliant with that of ctools (#2182). | 15 | cscripts behaviour compliant with that of ctools (#2182). |
| 14 | 16 |
doc/source/admin/release_history/1.5.rst
| @@ -39,6 +39,8 @@ Improvements | @@ -39,6 +39,8 @@ Improvements | ||
| 39 | :ref:`ctselect` informs about non-overlapping time interval | 39 | :ref:`ctselect` informs about non-overlapping time interval |
| 40 | * [`2267 <https://cta-redmine.irap.omp.eu/issues/2267>`_] - | 40 | * [`2267 <https://cta-redmine.irap.omp.eu/issues/2267>`_] - |
| 41 | Add tutorial for classical analysis | 41 | Add tutorial for classical analysis |
| 42 | +* [`2264 <https://cta-redmine.irap.omp.eu/issues/2264>`_] - | ||
| 43 | + In case of an error, test output is now written into log file | ||
| 42 | * [`2260 <https://cta-redmine.irap.omp.eu/issues/2260>`_] - | 44 | * [`2260 <https://cta-redmine.irap.omp.eu/issues/2260>`_] - |
| 43 | Handle On/Off observations by :ref:`cspull` | 45 | Handle On/Off observations by :ref:`cspull` |
| 44 | * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] - | 46 | * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] - |
test/test_cscaldb.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cscaldb script. | 3 | # This scripts performs unit tests for the cscaldb script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -68,10 +68,6 @@ class Test(test): | @@ -68,10 +68,6 @@ class Test(test): | ||
| 68 | # Setup cscaldb command | 68 | # Setup cscaldb command |
| 69 | cmd = cscaldb+' logfile="cscaldb_cmd1.log" chatter=1' | 69 | cmd = cscaldb+' logfile="cscaldb_cmd1.log" chatter=1' |
| 70 | 70 | ||
| 71 | - # Check if execution of wrong command fails | ||
| 72 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 73 | - 'Self test of test script') | ||
| 74 | - | ||
| 75 | # Check if execution was successful | 71 | # Check if execution was successful |
| 76 | self.test_assert(self._execute(cmd) == 0, | 72 | self.test_assert(self._execute(cmd) == 0, |
| 77 | 'Check successful execution from command line') | 73 | 'Check successful execution from command line') |
test/test_csebins.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cslightcrv script. | 3 | # This scripts performs unit tests for the cslightcrv script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -75,10 +75,6 @@ class Test(test): | @@ -75,10 +75,6 @@ class Test(test): | ||
| 75 | ' outfile="csebins_cmd1.fits"'+ \ | 75 | ' outfile="csebins_cmd1.fits"'+ \ |
| 76 | ' logfile="csebins_cmd1.log" chatter=1' | 76 | ' logfile="csebins_cmd1.log" chatter=1' |
| 77 | 77 | ||
| 78 | - # Check if execution of wrong command fails | ||
| 79 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 80 | - 'Self test of test script') | ||
| 81 | - | ||
| 82 | # Check if execution was successful | 78 | # Check if execution was successful |
| 83 | self.test_assert(self._execute(cmd) == 0, | 79 | self.test_assert(self._execute(cmd) == 0, |
| 84 | 'Check successful execution from command line') | 80 | 'Check successful execution from command line') |
| @@ -94,7 +90,7 @@ class Test(test): | @@ -94,7 +90,7 @@ class Test(test): | ||
| 94 | ' logfile="csebins_cmd2.log" debug=yes chatter=1' | 90 | ' logfile="csebins_cmd2.log" debug=yes chatter=1' |
| 95 | 91 | ||
| 96 | # Check if execution failed | 92 | # Check if execution failed |
| 97 | - self.test_assert(self._execute(cmd) != 0, | 93 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 98 | 'Check invalid input file when executed from command line') | 94 | 'Check invalid input file when executed from command line') |
| 99 | 95 | ||
| 100 | # Check csebins --help | 96 | # Check csebins --help |
test/test_csfindobs.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csfindobs script. | 3 | # This scripts performs unit tests for the csfindobs script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -78,10 +78,6 @@ class Test(test): | @@ -78,10 +78,6 @@ class Test(test): | ||
| 78 | ' outfile="runlist_cmd1.dat"'+ \ | 78 | ' outfile="runlist_cmd1.dat"'+ \ |
| 79 | ' logfile="csfindobs_cmd1.log" chatter=1' | 79 | ' logfile="csfindobs_cmd1.log" chatter=1' |
| 80 | 80 | ||
| 81 | - # Check if execution of wrong command fails | ||
| 82 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 83 | - 'Self test of test script') | ||
| 84 | - | ||
| 85 | # Check if execution was successful | 81 | # Check if execution was successful |
| 86 | self.test_assert(self._execute(cmd) == 0, | 82 | self.test_assert(self._execute(cmd) == 0, |
| 87 | 'Check successful execution from command line') | 83 | 'Check successful execution from command line') |
| @@ -97,7 +93,7 @@ class Test(test): | @@ -97,7 +93,7 @@ class Test(test): | ||
| 97 | ' logfile="csfindobs_cmd2.log" debug=yes' | 93 | ' logfile="csfindobs_cmd2.log" debug=yes' |
| 98 | 94 | ||
| 99 | # Check if execution failed | 95 | # Check if execution failed |
| 100 | - self.test_assert(self._execute(cmd) != 0, | 96 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 101 | 'Check invalid input file when executed from command line') | 97 | 'Check invalid input file when executed from command line') |
| 102 | 98 | ||
| 103 | # Check csfindobs --help | 99 | # Check csfindobs --help |
test/test_csiactcopy.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csiactcopy script. | 3 | # This scripts performs unit tests for the csiactcopy script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -80,10 +80,6 @@ class Test(test): | @@ -80,10 +80,6 @@ class Test(test): | ||
| 80 | ' outpath="csiactcopy_cmd1"'+ \ | 80 | ' outpath="csiactcopy_cmd1"'+ \ |
| 81 | ' logfile="csiactcopy_cmd1.log" chatter=1' | 81 | ' logfile="csiactcopy_cmd1.log" chatter=1' |
| 82 | 82 | ||
| 83 | - # Check if execution of wrong command fails | ||
| 84 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 85 | - 'Self test of test script') | ||
| 86 | - | ||
| 87 | # Check if execution was successful | 83 | # Check if execution was successful |
| 88 | self.test_assert(self._execute(cmd) == 0, | 84 | self.test_assert(self._execute(cmd) == 0, |
| 89 | 'Check successful execution from command line') | 85 | 'Check successful execution from command line') |
| @@ -98,7 +94,7 @@ class Test(test): | @@ -98,7 +94,7 @@ class Test(test): | ||
| 98 | ' logfile="csiactcopy_cmd2.log" debug=yes' | 94 | ' logfile="csiactcopy_cmd2.log" debug=yes' |
| 99 | 95 | ||
| 100 | # Check if execution failed | 96 | # Check if execution failed |
| 101 | - self.test_assert(self._execute(cmd) != 0, | 97 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 102 | 'Check invalid input file when executed from command line') | 98 | 'Check invalid input file when executed from command line') |
| 103 | 99 | ||
| 104 | # Check csiactcopy --help | 100 | # Check csiactcopy --help |
test/test_csiactdata.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csiactdata script | 3 | # This scripts performs unit tests for the csiactdata script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -75,10 +75,6 @@ class Test(test): | @@ -75,10 +75,6 @@ class Test(test): | ||
| 75 | cmd = csiactdata+' datapath="'+self._datapath+'"'+ \ | 75 | cmd = csiactdata+' datapath="'+self._datapath+'"'+ \ |
| 76 | ' logfile="csiactdata_cmd1.log" chatter=1' | 76 | ' logfile="csiactdata_cmd1.log" chatter=1' |
| 77 | 77 | ||
| 78 | - # Check if execution of wrong command fails | ||
| 79 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 80 | - 'Self test of test script') | ||
| 81 | - | ||
| 82 | # Check if execution was successful | 78 | # Check if execution was successful |
| 83 | self.test_assert(self._execute(cmd) == 0, | 79 | self.test_assert(self._execute(cmd) == 0, |
| 84 | 'Check successful execution from command line') | 80 | 'Check successful execution from command line') |
| @@ -88,7 +84,7 @@ class Test(test): | @@ -88,7 +84,7 @@ class Test(test): | ||
| 88 | ' logfile="csiactdata_cmd2.log" debug=yes' | 84 | ' logfile="csiactdata_cmd2.log" debug=yes' |
| 89 | 85 | ||
| 90 | # Check if execution failed | 86 | # Check if execution failed |
| 91 | - self.test_assert(self._execute(cmd) != 0, | 87 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 92 | 'Check invalid input file when executed from command line') | 88 | 'Check invalid input file when executed from command line') |
| 93 | 89 | ||
| 94 | # Check csiactdata --help | 90 | # Check csiactdata --help |
test/test_csiactobs.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csiactobs script | 3 | # This scripts performs unit tests for the csiactobs script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -81,10 +81,6 @@ class Test(test): | @@ -81,10 +81,6 @@ class Test(test): | ||
| 81 | ' outmodel="csiactobs_bgd_cmd1.xml"'+ \ | 81 | ' outmodel="csiactobs_bgd_cmd1.xml"'+ \ |
| 82 | ' logfile="csiactobs_cmd1.log" chatter=1' | 82 | ' logfile="csiactobs_cmd1.log" chatter=1' |
| 83 | 83 | ||
| 84 | - # Check if execution of wrong command fails | ||
| 85 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 86 | - 'Self test of test script') | ||
| 87 | - | ||
| 88 | # Check if execution was successful | 84 | # Check if execution was successful |
| 89 | self.test_assert(self._execute(cmd) == 0, | 85 | self.test_assert(self._execute(cmd) == 0, |
| 90 | 'Check successful execution from command line') | 86 | 'Check successful execution from command line') |
| @@ -106,7 +102,7 @@ class Test(test): | @@ -106,7 +102,7 @@ class Test(test): | ||
| 106 | ' chatter=1' | 102 | ' chatter=1' |
| 107 | 103 | ||
| 108 | # Check if execution failed | 104 | # Check if execution failed |
| 109 | - self.test_assert(self._execute(cmd) != 0, | 105 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 110 | 'Check invalid input datapath when executed from command line') | 106 | 'Check invalid input datapath when executed from command line') |
| 111 | 107 | ||
| 112 | # Setup csiactobs command | 108 | # Setup csiactobs command |
| @@ -120,7 +116,7 @@ class Test(test): | @@ -120,7 +116,7 @@ class Test(test): | ||
| 120 | ' chatter=1' | 116 | ' chatter=1' |
| 121 | 117 | ||
| 122 | # Check if execution failed | 118 | # Check if execution failed |
| 123 | - self.test_assert(self._execute(cmd) != 0, | 119 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 124 | 'Check invalid input prodname when executed from command line') | 120 | 'Check invalid input prodname when executed from command line') |
| 125 | 121 | ||
| 126 | # Check csiactobs --help | 122 | # Check csiactobs --help |
test/test_csinfo.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csinfo script. | 3 | # This scripts performs unit tests for the csinfo script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -18,8 +18,6 @@ | @@ -18,8 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -#import gammalib | ||
| 22 | -#import cscripts | ||
| 23 | from testing import test | 21 | from testing import test |
| 24 | 22 | ||
| 25 | 23 | ||
| @@ -67,10 +65,6 @@ class Test(test): | @@ -67,10 +65,6 @@ class Test(test): | ||
| 67 | # Setup csinfo command | 65 | # Setup csinfo command |
| 68 | cmd = csinfo | 66 | cmd = csinfo |
| 69 | 67 | ||
| 70 | - # Check if execution of wrong command fails | ||
| 71 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 72 | - 'Self test of test script') | ||
| 73 | - | ||
| 74 | # Execute script without arguments | 68 | # Execute script without arguments |
| 75 | self.test_assert(self._execute(cmd) == 0, | 69 | self.test_assert(self._execute(cmd) == 0, |
| 76 | 'Check successful execution from command line') | 70 | 'Check successful execution from command line') |
| @@ -88,9 +82,10 @@ class Test(test): | @@ -88,9 +82,10 @@ class Test(test): | ||
| 88 | 'Check successful execution with "info" argument from command line') | 82 | 'Check successful execution with "info" argument from command line') |
| 89 | 83 | ||
| 90 | # Execute script with invalid argument | 84 | # Execute script with invalid argument |
| 91 | - self.test_assert(self._execute(cmd+' not_a_valid_argument') != 0, | ||
| 92 | - 'Check unsuccessful execution with unsupported argument from ' | ||
| 93 | - 'command line') | 85 | + self.test_assert(self._execute(cmd+' not_a_valid_argument', |
| 86 | + success=False) != 0, | ||
| 87 | + 'Check unsuccessful execution with unsupported ' | ||
| 88 | + 'argument from command line') | ||
| 94 | 89 | ||
| 95 | # Return | 90 | # Return |
| 96 | return | 91 | return |
test/test_cslightcrv.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cslightcrv script. | 3 | # This scripts performs unit tests for the cslightcrv script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -82,10 +82,6 @@ class Test(test): | @@ -82,10 +82,6 @@ class Test(test): | ||
| 82 | ' outfile="lightcurve_cmd1.fits"'+ \ | 82 | ' outfile="lightcurve_cmd1.fits"'+ \ |
| 83 | ' logfile="cslightcrv_cmd1.log" chatter=1' | 83 | ' logfile="cslightcrv_cmd1.log" chatter=1' |
| 84 | 84 | ||
| 85 | - # Check if execution of wrong command fails | ||
| 86 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 87 | - 'Self test of test script') | ||
| 88 | - | ||
| 89 | # Check if execution was successful | 85 | # Check if execution was successful |
| 90 | self.test_assert(self._execute(cmd) == 0, | 86 | self.test_assert(self._execute(cmd) == 0, |
| 91 | 'Check successful execution from command line') | 87 | 'Check successful execution from command line') |
| @@ -104,7 +100,7 @@ class Test(test): | @@ -104,7 +100,7 @@ class Test(test): | ||
| 104 | ' logfile="cslightcrv_cmd2.log" debug=yes' | 100 | ' logfile="cslightcrv_cmd2.log" debug=yes' |
| 105 | 101 | ||
| 106 | # Check if execution failed | 102 | # Check if execution failed |
| 107 | - self.test_assert(self._execute(cmd) != 0, | 103 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 108 | 'Check invalid input file when executed from command line') | 104 | 'Check invalid input file when executed from command line') |
| 109 | 105 | ||
| 110 | # Check cslightcrv --help | 106 | # Check cslightcrv --help |
test/test_csmodelinfo.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csmodelinfo script. | 3 | # This scripts performs unit tests for the csmodelinfo script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -#import gammalib | ||
| 22 | import cscripts | 21 | import cscripts |
| 23 | from testing import test | 22 | from testing import test |
| 24 | 23 | ||
| @@ -77,10 +76,6 @@ class Test(test): | @@ -77,10 +76,6 @@ class Test(test): | ||
| 77 | ' outds9file="csmodelinfo_cmd1.reg"'+ \ | 76 | ' outds9file="csmodelinfo_cmd1.reg"'+ \ |
| 78 | ' logfile="csmodelinfo_cmd1.log" chatter=1' | 77 | ' logfile="csmodelinfo_cmd1.log" chatter=1' |
| 79 | 78 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 79 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 80 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 81 | 'Check successful execution from command line') |
| @@ -94,7 +89,7 @@ class Test(test): | @@ -94,7 +89,7 @@ class Test(test): | ||
| 94 | ' logfile="csmodelinfo_cmd2.log" debug=yes' | 89 | ' logfile="csmodelinfo_cmd2.log" debug=yes' |
| 95 | 90 | ||
| 96 | # Check if execution failed | 91 | # Check if execution failed |
| 97 | - self.test_assert(self._execute(cmd) != 0, | 92 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 98 | 'Check invalid input file when executed from command line') | 93 | 'Check invalid input file when executed from command line') |
| 99 | 94 | ||
| 100 | # Check csmodelinfo --help | 95 | # Check csmodelinfo --help |
test/test_csmodelmerge.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csmodelmerge script. | 3 | # This scripts performs unit tests for the csmodelmerge script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -79,10 +79,6 @@ class Test(test): | @@ -79,10 +79,6 @@ class Test(test): | ||
| 79 | ' outmodel="csmodelmerge_cmd1.xml"'+ \ | 79 | ' outmodel="csmodelmerge_cmd1.xml"'+ \ |
| 80 | ' logfile="csmodelmerge_cmd1.log" chatter=1' | 80 | ' logfile="csmodelmerge_cmd1.log" chatter=1' |
| 81 | 81 | ||
| 82 | - # Check if execution of wrong command fails | ||
| 83 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 84 | - 'Self test of test script') | ||
| 85 | - | ||
| 86 | # Check if execution was successful | 82 | # Check if execution was successful |
| 87 | self.test_assert(self._execute(cmd) == 0, | 83 | self.test_assert(self._execute(cmd) == 0, |
| 88 | 'Check successful execution from command line') | 84 | 'Check successful execution from command line') |
| @@ -96,7 +92,7 @@ class Test(test): | @@ -96,7 +92,7 @@ class Test(test): | ||
| 96 | ' logfile="csmodelmerge_cmd2.log" debug=yes' | 92 | ' logfile="csmodelmerge_cmd2.log" debug=yes' |
| 97 | 93 | ||
| 98 | # Check if execution failed | 94 | # Check if execution failed |
| 99 | - self.test_assert(self._execute(cmd) != 0, | 95 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 100 | 'Check invalid input file when executed from command line') | 96 | 'Check invalid input file when executed from command line') |
| 101 | 97 | ||
| 102 | # Check csmodelmerge --help | 98 | # Check csmodelmerge --help |
test/test_csmodelselect.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csmodelselect script | 3 | # This scripts performs unit tests for the csmodelselect script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -74,10 +74,6 @@ class Test(test): | @@ -74,10 +74,6 @@ class Test(test): | ||
| 74 | ' outmodel="csmodelselect_cmd1.xml"'+ \ | 74 | ' outmodel="csmodelselect_cmd1.xml"'+ \ |
| 75 | ' logfile="csmodelselect_cmd1.log" chatter=1' | 75 | ' logfile="csmodelselect_cmd1.log" chatter=1' |
| 76 | 76 | ||
| 77 | - # Check if execution of wrong command fails | ||
| 78 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 79 | - 'Self test of test script') | ||
| 80 | - | ||
| 81 | # Check if execution was successful | 77 | # Check if execution was successful |
| 82 | self.test_assert(self._execute(cmd) == 0, | 78 | self.test_assert(self._execute(cmd) == 0, |
| 83 | 'Check successful execution from command line') | 79 | 'Check successful execution from command line') |
| @@ -92,7 +88,7 @@ class Test(test): | @@ -92,7 +88,7 @@ class Test(test): | ||
| 92 | ' logfile="csmodelselect_cmd2.log" debug=yes' | 88 | ' logfile="csmodelselect_cmd2.log" debug=yes' |
| 93 | 89 | ||
| 94 | # Check if execution failed | 90 | # Check if execution failed |
| 95 | - self.test_assert(self._execute(cmd) != 0, | 91 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 96 | 'Check invalid input file when executed from command line') | 92 | 'Check invalid input file when executed from command line') |
| 97 | 93 | ||
| 98 | # Check csmodelselect --help | 94 | # Check csmodelselect --help |
test/test_csmodelsois.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csmodelsois tool. | 3 | # This scripts performs unit tests for the csmodelsois tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 Josh Cardenzana | 5 | +# Copyright (C) 2017-2018 Josh Cardenzana |
| 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 |
| @@ -78,10 +78,6 @@ class Test(test): | @@ -78,10 +78,6 @@ class Test(test): | ||
| 78 | ' ra=83.63 dec=22.01 proj=CAR'+ \ | 78 | ' ra=83.63 dec=22.01 proj=CAR'+ \ |
| 79 | ' logfile="csmodelsois_cmd1.log" chatter=1' | 79 | ' logfile="csmodelsois_cmd1.log" chatter=1' |
| 80 | 80 | ||
| 81 | - # Check if execution of wrong command fails | ||
| 82 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 83 | - 'Self test of test script') | ||
| 84 | - | ||
| 85 | # Check if execution was successful | 81 | # Check if execution was successful |
| 86 | self.test_assert(self._execute(cmd) == 0, | 82 | self.test_assert(self._execute(cmd) == 0, |
| 87 | 'Check successful execution from command line') | 83 | 'Check successful execution from command line') |
| @@ -99,7 +95,7 @@ class Test(test): | @@ -99,7 +95,7 @@ class Test(test): | ||
| 99 | ' logfile="csmodelsois_cmd2.log" debug=yes' | 95 | ' logfile="csmodelsois_cmd2.log" debug=yes' |
| 100 | 96 | ||
| 101 | # Check if execution failed | 97 | # Check if execution failed |
| 102 | - self.test_assert(self._execute(cmd) != 0, | 98 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 103 | 'Check invalid input file when executed from command line') | 99 | 'Check invalid input file when executed from command line') |
| 104 | 100 | ||
| 105 | # Check csmodelsois --help | 101 | # Check csmodelsois --help |
test/test_csobs2caldb.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csobs2caldb script. | 3 | # This scripts performs unit tests for the csobs2caldb script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -81,10 +81,6 @@ class Test(test): | @@ -81,10 +81,6 @@ class Test(test): | ||
| 81 | ' caldb="cta" irf="Cmd1" rootdir="caldb"'+ \ | 81 | ' caldb="cta" irf="Cmd1" rootdir="caldb"'+ \ |
| 82 | ' logfile="csobs2caldb_cmd1.log" chatter=1' | 82 | ' logfile="csobs2caldb_cmd1.log" chatter=1' |
| 83 | 83 | ||
| 84 | - # Check if execution of wrong command fails | ||
| 85 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 86 | - 'Self test of test script') | ||
| 87 | - | ||
| 88 | # Check if execution was successful | 84 | # Check if execution was successful |
| 89 | self.test_assert(self._execute(cmd) == 0, | 85 | self.test_assert(self._execute(cmd) == 0, |
| 90 | 'Check successful execution from command line') | 86 | 'Check successful execution from command line') |
| @@ -98,7 +94,7 @@ class Test(test): | @@ -98,7 +94,7 @@ class Test(test): | ||
| 98 | ' logfile="csobs2caldb_cmd2.log" debug=yes' | 94 | ' logfile="csobs2caldb_cmd2.log" debug=yes' |
| 99 | 95 | ||
| 100 | # Check if execution failed | 96 | # Check if execution failed |
| 101 | - self.test_assert(self._execute(cmd) != 0, | 97 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 102 | 'Check invalid input file when executed from command line') | 98 | 'Check invalid input file when executed from command line') |
| 103 | 99 | ||
| 104 | # Check csobs2caldb --help | 100 | # Check csobs2caldb --help |
test/test_csobsdef.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csobsdef script. | 3 | # This scripts performs unit tests for the csobsdef script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -79,10 +79,6 @@ class Test(test): | @@ -79,10 +79,6 @@ class Test(test): | ||
| 79 | ' emin=0.1 emax=100.0 duration=1800.0 rad=5.0'+ \ | 79 | ' emin=0.1 emax=100.0 duration=1800.0 rad=5.0'+ \ |
| 80 | ' logfile="csobsdef_cmd1.log" chatter=1' | 80 | ' logfile="csobsdef_cmd1.log" chatter=1' |
| 81 | 81 | ||
| 82 | - # Check if execution of wrong command fails | ||
| 83 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 84 | - 'Self test of test script') | ||
| 85 | - | ||
| 86 | # Check if execution was successful | 82 | # Check if execution was successful |
| 87 | self.test_assert(self._execute(cmd) == 0, | 83 | self.test_assert(self._execute(cmd) == 0, |
| 88 | 'Check successful execution from command line') | 84 | 'Check successful execution from command line') |
| @@ -98,7 +94,7 @@ class Test(test): | @@ -98,7 +94,7 @@ class Test(test): | ||
| 98 | ' logfile="csobsdef_cmd2.log" debug=yes' | 94 | ' logfile="csobsdef_cmd2.log" debug=yes' |
| 99 | 95 | ||
| 100 | # Check if execution failed | 96 | # Check if execution failed |
| 101 | - self.test_assert(self._execute(cmd) != 0, | 97 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 102 | 'Check invalid input file when executed from command line') | 98 | 'Check invalid input file when executed from command line') |
| 103 | 99 | ||
| 104 | # Check csobsdef --help | 100 | # Check csobsdef --help |
test/test_csobsinfo.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csobsinfo script. | 3 | # This scripts performs unit tests for the csobsinfo script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -#import gammalib | ||
| 22 | import cscripts | 21 | import cscripts |
| 23 | from testing import test | 22 | from testing import test |
| 24 | 23 | ||
| @@ -77,10 +76,6 @@ class Test(test): | @@ -77,10 +76,6 @@ class Test(test): | ||
| 77 | ' offset=yes ra=83.63 dec=22.01'+ \ | 76 | ' offset=yes ra=83.63 dec=22.01'+ \ |
| 78 | ' logfile="csobsinfo_cmd1.log" chatter=1' | 77 | ' logfile="csobsinfo_cmd1.log" chatter=1' |
| 79 | 78 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 79 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 80 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 81 | 'Check successful execution from command line') |
| @@ -95,7 +90,7 @@ class Test(test): | @@ -95,7 +90,7 @@ class Test(test): | ||
| 95 | ' logfile="csobsinfo_cmd2.log" debug=yes' | 90 | ' logfile="csobsinfo_cmd2.log" debug=yes' |
| 96 | 91 | ||
| 97 | # Check if execution failed | 92 | # Check if execution failed |
| 98 | - self.test_assert(self._execute(cmd) != 0, | 93 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 99 | 'Check invalid input file when executed from command line') | 94 | 'Check invalid input file when executed from command line') |
| 100 | 95 | ||
| 101 | # Check csobsinfo --help | 96 | # Check csobsinfo --help |
test/test_csobsselect.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csobsselect script | 3 | # This scripts performs unit tests for the csobsselect script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -75,10 +75,6 @@ class Test(test): | @@ -75,10 +75,6 @@ class Test(test): | ||
| 75 | ' dec=22.01 rad=5.0'+ \ | 75 | ' dec=22.01 rad=5.0'+ \ |
| 76 | ' logfile="csobsselect_cmd1.log" chatter=1' | 76 | ' logfile="csobsselect_cmd1.log" chatter=1' |
| 77 | 77 | ||
| 78 | - # Check if execution of wrong command fails | ||
| 79 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 80 | - 'Self test of test script') | ||
| 81 | - | ||
| 82 | # Check if execution was successful | 78 | # Check if execution was successful |
| 83 | self.test_assert(self._execute(cmd) == 0, | 79 | self.test_assert(self._execute(cmd) == 0, |
| 84 | 'Check successful execution from command line') | 80 | 'Check successful execution from command line') |
| @@ -94,7 +90,7 @@ class Test(test): | @@ -94,7 +90,7 @@ class Test(test): | ||
| 94 | ' logfile="csobsselect_cmd2.log" debug=yes chatter=2' | 90 | ' logfile="csobsselect_cmd2.log" debug=yes chatter=2' |
| 95 | 91 | ||
| 96 | # Check if execution failed | 92 | # Check if execution failed |
| 97 | - self.test_assert(self._execute(cmd) != 0, | 93 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 98 | 'Check invalid input file when executed from command line') | 94 | 'Check invalid input file when executed from command line') |
| 99 | 95 | ||
| 100 | # Check csobsselect --help | 96 | # Check csobsselect --help |
test/test_csphagen.py
| @@ -93,10 +93,6 @@ class Test(test): | @@ -93,10 +93,6 @@ class Test(test): | ||
| 93 | 'outobs="csphagen_cmd1.xml" prefix="csphagen_cmd1" ' + \ | 93 | 'outobs="csphagen_cmd1.xml" prefix="csphagen_cmd1" ' + \ |
| 94 | 'logfile="csphagen_cmd1.log" chatter=2' | 94 | 'logfile="csphagen_cmd1.log" chatter=2' |
| 95 | 95 | ||
| 96 | - # Check if execution of wrong command fails | ||
| 97 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 98 | - 'Self test of test script') | ||
| 99 | - | ||
| 100 | # Check if execution was successful | 96 | # Check if execution was successful |
| 101 | self.test_assert(self._execute(cmd) == 0, | 97 | self.test_assert(self._execute(cmd) == 0, |
| 102 | 'Check successful execution from command line') | 98 | 'Check successful execution from command line') |
| @@ -119,8 +115,8 @@ class Test(test): | @@ -119,8 +115,8 @@ class Test(test): | ||
| 119 | 'logfile="csphagen_cmd2.log" debug=yes chatter=1' | 115 | 'logfile="csphagen_cmd2.log" debug=yes chatter=1' |
| 120 | 116 | ||
| 121 | # Check if execution failed | 117 | # Check if execution failed |
| 122 | - self.test_assert(self._execute(cmd) != 0, | ||
| 123 | - 'Check invalid input file when executed from command line') | 118 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 119 | + 'Check invalid input file when executed from command line') | ||
| 124 | 120 | ||
| 125 | # Check csphagen --help | 121 | # Check csphagen --help |
| 126 | self._check_help(csphagen) | 122 | self._check_help(csphagen) |
test/test_csphasecrv.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csphasecrv script. | 3 | # This scripts performs unit tests for the csphasecrv script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2017-2018 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 |
| @@ -82,10 +82,6 @@ class Test(test): | @@ -82,10 +82,6 @@ class Test(test): | ||
| 82 | ' outfile="csphasecrv_cmd1.fits"'+ \ | 82 | ' outfile="csphasecrv_cmd1.fits"'+ \ |
| 83 | ' logfile="csphasecrv_cmd1.log" chatter=1' | 83 | ' logfile="csphasecrv_cmd1.log" chatter=1' |
| 84 | 84 | ||
| 85 | - # Check if execution of wrong command fails | ||
| 86 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 87 | - 'Self test of test script') | ||
| 88 | - | ||
| 89 | # Check if execution was successful | 85 | # Check if execution was successful |
| 90 | self.test_assert(self._execute(cmd) == 0, | 86 | self.test_assert(self._execute(cmd) == 0, |
| 91 | 'Check successful execution from command line') | 87 | 'Check successful execution from command line') |
| @@ -103,7 +99,7 @@ class Test(test): | @@ -103,7 +99,7 @@ class Test(test): | ||
| 103 | ' logfile="csphasecrv_cmd2.log" debug=yes chatter=1' | 99 | ' logfile="csphasecrv_cmd2.log" debug=yes chatter=1' |
| 104 | 100 | ||
| 105 | # Check if execution failed | 101 | # Check if execution failed |
| 106 | - self.test_assert(self._execute(cmd) != 0, | 102 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 107 | 'Check invalid input file when executed from command line') | 103 | 'Check invalid input file when executed from command line') |
| 108 | 104 | ||
| 109 | # Check csphasecrv --help | 105 | # Check csphasecrv --help |
test/test_cspull.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cspull script. | 3 | # This scripts performs unit tests for the cspull script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -84,10 +84,6 @@ class Test(test): | @@ -84,10 +84,6 @@ class Test(test): | ||
| 84 | ' npix=200 binsz=0.05'+ \ | 84 | ' npix=200 binsz=0.05'+ \ |
| 85 | ' logfile="cspull_cmd1.log" chatter=1' | 85 | ' logfile="cspull_cmd1.log" chatter=1' |
| 86 | 86 | ||
| 87 | - # Check if execution of wrong command fails | ||
| 88 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 89 | - 'Self test of test script') | ||
| 90 | - | ||
| 91 | # Check if execution was successful | 87 | # Check if execution was successful |
| 92 | self.test_assert(self._execute(cmd) == 0, | 88 | self.test_assert(self._execute(cmd) == 0, |
| 93 | 'Check successful execution from command line') | 89 | 'Check successful execution from command line') |
| @@ -106,7 +102,7 @@ class Test(test): | @@ -106,7 +102,7 @@ class Test(test): | ||
| 106 | ' logfile="cspull_cmd2.log" debug=yes' | 102 | ' logfile="cspull_cmd2.log" debug=yes' |
| 107 | 103 | ||
| 108 | # Check if execution failed | 104 | # Check if execution failed |
| 109 | - self.test_assert(self._execute(cmd) != 0, | 105 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 110 | 'Check invalid input file when executed from command line') | 106 | 'Check invalid input file when executed from command line') |
| 111 | 107 | ||
| 112 | # Check cspull --help | 108 | # Check cspull --help |
test/test_csresmap.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csresmap script. | 3 | # This scripts performs unit tests for the csresmap script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -79,10 +79,6 @@ class Test(test): | @@ -79,10 +79,6 @@ class Test(test): | ||
| 79 | ' algorithm="SUBDIVSQRT"'+ \ | 79 | ' algorithm="SUBDIVSQRT"'+ \ |
| 80 | ' logfile="csresmap_cmd1.log" chatter=1' | 80 | ' logfile="csresmap_cmd1.log" chatter=1' |
| 81 | 81 | ||
| 82 | - # Check if execution of wrong command fails | ||
| 83 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 84 | - 'Self test of test script') | ||
| 85 | - | ||
| 86 | # Check if execution was successful | 82 | # Check if execution was successful |
| 87 | self.test_assert(self._execute(cmd) == 0, | 83 | self.test_assert(self._execute(cmd) == 0, |
| 88 | 'Check successful execution from command line') | 84 | 'Check successful execution from command line') |
| @@ -102,7 +98,7 @@ class Test(test): | @@ -102,7 +98,7 @@ class Test(test): | ||
| 102 | ' logfile="csresmap_cmd2.log" debug=yes chatter=2' | 98 | ' logfile="csresmap_cmd2.log" debug=yes chatter=2' |
| 103 | 99 | ||
| 104 | # Check if execution failed | 100 | # Check if execution failed |
| 105 | - self.test_assert(self._execute(cmd) != 0, | 101 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 106 | 'Check invalid input file when executed from command line') | 102 | 'Check invalid input file when executed from command line') |
| 107 | 103 | ||
| 108 | # Check csresmap --help | 104 | # Check csresmap --help |
test/test_csresspec.py
| @@ -81,10 +81,6 @@ class Test(test): | @@ -81,10 +81,6 @@ class Test(test): | ||
| 81 | ' mask=no algorithm="SUB"' + \ | 81 | ' mask=no algorithm="SUB"' + \ |
| 82 | ' logfile="csresspec_cmd1.log" chatter=4' | 82 | ' logfile="csresspec_cmd1.log" chatter=4' |
| 83 | 83 | ||
| 84 | - # Check if execution of wrong command fails | ||
| 85 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 86 | - 'Self test of test script') | ||
| 87 | - | ||
| 88 | # Check if execution was successful | 84 | # Check if execution was successful |
| 89 | self.test_assert(self._execute(cmd) == 0, | 85 | self.test_assert(self._execute(cmd) == 0, |
| 90 | 'Check successful execution from command line') | 86 | 'Check successful execution from command line') |
| @@ -102,8 +98,8 @@ class Test(test): | @@ -102,8 +98,8 @@ class Test(test): | ||
| 102 | ' logfile="csresspec_cmd2.log" debug=yes chatter=2' | 98 | ' logfile="csresspec_cmd2.log" debug=yes chatter=2' |
| 103 | 99 | ||
| 104 | # Check if execution failed | 100 | # Check if execution failed |
| 105 | - self.test_assert(self._execute(cmd) != 0, | ||
| 106 | - 'Check invalid input file when executed from command line') | 101 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 102 | + 'Check invalid input file when executed from command line') | ||
| 107 | 103 | ||
| 108 | # Check csresspec --help | 104 | # Check csresspec --help |
| 109 | self._check_help(csresspec) | 105 | self._check_help(csresspec) |
test/test_csroot2caldb.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csroot2caldb script. | 3 | # This scripts performs unit tests for the csroot2caldb script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import os | 21 | import os |
| 22 | -#import gammalib | ||
| 23 | import cscripts | 22 | import cscripts |
| 24 | from testing import test | 23 | from testing import test |
| 25 | 24 | ||
| @@ -82,10 +81,6 @@ class Test(test): | @@ -82,10 +81,6 @@ class Test(test): | ||
| 82 | ' analysis=DESY zenith=20.0 azimuth=0.0'+ \ | 81 | ' analysis=DESY zenith=20.0 azimuth=0.0'+ \ |
| 83 | ' logfile="csroot2caldb_cmd1.log" chatter=2' | 82 | ' logfile="csroot2caldb_cmd1.log" chatter=2' |
| 84 | 83 | ||
| 85 | - # Check if execution of wrong command fails | ||
| 86 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 87 | - 'Self test of test script') | ||
| 88 | - | ||
| 89 | # Check if execution was successful | 84 | # Check if execution was successful |
| 90 | self.test_assert(self._execute(cmd) == 0, | 85 | self.test_assert(self._execute(cmd) == 0, |
| 91 | 'Check successful execution from command line') | 86 | 'Check successful execution from command line') |
test/test_cssens.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cssens script | 3 | # This scripts performs unit tests for the cssens script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -79,10 +79,6 @@ class Test(test): | @@ -79,10 +79,6 @@ class Test(test): | ||
| 79 | ' outfile="cssens_cmd1.dat"'+ \ | 79 | ' outfile="cssens_cmd1.dat"'+ \ |
| 80 | ' logfile="cssens_cmd1.log" chatter=1' | 80 | ' logfile="cssens_cmd1.log" chatter=1' |
| 81 | 81 | ||
| 82 | - # Check if execution of wrong command fails | ||
| 83 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 84 | - 'Self test of test script') | ||
| 85 | - | ||
| 86 | # Check if execution was successful | 82 | # Check if execution was successful |
| 87 | self.test_assert(self._execute(cmd) == 0, | 83 | self.test_assert(self._execute(cmd) == 0, |
| 88 | 'Check successful execution from command line') | 84 | 'Check successful execution from command line') |
| @@ -99,7 +95,7 @@ class Test(test): | @@ -99,7 +95,7 @@ class Test(test): | ||
| 99 | ' logfile="cssens_cmd2.log" debug=yes chatter=2' | 95 | ' logfile="cssens_cmd2.log" debug=yes chatter=2' |
| 100 | 96 | ||
| 101 | # Check if execution failed | 97 | # Check if execution failed |
| 102 | - self.test_assert(self._execute(cmd) != 0, | 98 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 103 | 'Check invalid input file when executed from command line') | 99 | 'Check invalid input file when executed from command line') |
| 104 | 100 | ||
| 105 | # Check cssens --help | 101 | # Check cssens --help |
test/test_csspec.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csspec script. | 3 | # This scripts performs unit tests for the csspec script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -87,10 +87,6 @@ class Test(test): | @@ -87,10 +87,6 @@ class Test(test): | ||
| 87 | ' outfile="csspec_cmd1.fits"'+ \ | 87 | ' outfile="csspec_cmd1.fits"'+ \ |
| 88 | ' logfile="csspec_cmd1.log" chatter=1' | 88 | ' logfile="csspec_cmd1.log" chatter=1' |
| 89 | 89 | ||
| 90 | - # Check if execution of wrong command fails | ||
| 91 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 92 | - 'Self test of test script') | ||
| 93 | - | ||
| 94 | # Check if execution was successful | 90 | # Check if execution was successful |
| 95 | self.test_assert(self._execute(cmd) == 0, | 91 | self.test_assert(self._execute(cmd) == 0, |
| 96 | 'Check successful execution from command line') | 92 | 'Check successful execution from command line') |
| @@ -108,7 +104,7 @@ class Test(test): | @@ -108,7 +104,7 @@ class Test(test): | ||
| 108 | ' logfile="csspec_cmd2.log" debug=yes chatter=1' | 104 | ' logfile="csspec_cmd2.log" debug=yes chatter=1' |
| 109 | 105 | ||
| 110 | # Check if execution failed | 106 | # Check if execution failed |
| 111 | - self.test_assert(self._execute(cmd) != 0, | 107 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 112 | 'Check invalid input file when executed from command line') | 108 | 'Check invalid input file when executed from command line') |
| 113 | 109 | ||
| 114 | # Check csspec --help | 110 | # Check csspec --help |
test/test_cssrcdetect.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cssrcdetect script | 3 | # This scripts performs unit tests for the cssrcdetect script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -78,10 +78,6 @@ class Test(test): | @@ -78,10 +78,6 @@ class Test(test): | ||
| 78 | ' srcmodel="POINT" bkgmodel="NONE" threshold=10.0'+ \ | 78 | ' srcmodel="POINT" bkgmodel="NONE" threshold=10.0'+ \ |
| 79 | ' logfile="cssrcdetect_cmd1.log" chatter=1' | 79 | ' logfile="cssrcdetect_cmd1.log" chatter=1' |
| 80 | 80 | ||
| 81 | - # Check if execution of wrong command fails | ||
| 82 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 83 | - 'Self test of test script') | ||
| 84 | - | ||
| 85 | # Check if execution was successful | 81 | # Check if execution was successful |
| 86 | self.test_assert(self._execute(cmd) == 0, | 82 | self.test_assert(self._execute(cmd) == 0, |
| 87 | 'Check successful execution from command line') | 83 | 'Check successful execution from command line') |
| @@ -97,7 +93,7 @@ class Test(test): | @@ -97,7 +93,7 @@ class Test(test): | ||
| 97 | ' logfile="cssrcdetect_cmd2.log" debug=yes chatter=2' | 93 | ' logfile="cssrcdetect_cmd2.log" debug=yes chatter=2' |
| 98 | 94 | ||
| 99 | # Check if execution failed | 95 | # Check if execution failed |
| 100 | - self.test_assert(self._execute(cmd) != 0, | 96 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 101 | 'Check invalid input file when executed from command line') | 97 | 'Check invalid input file when executed from command line') |
| 102 | 98 | ||
| 103 | # Check cssrcdetect --help | 99 | # Check cssrcdetect --help |
test/test_cstsdist.py
| @@ -85,10 +85,6 @@ class Test(test): | @@ -85,10 +85,6 @@ class Test(test): | ||
| 85 | ' outfile="cstsdist_cmd1.dat"'+ \ | 85 | ' outfile="cstsdist_cmd1.dat"'+ \ |
| 86 | ' logfile="cstsdist_cmd1.log" chatter=2' | 86 | ' logfile="cstsdist_cmd1.log" chatter=2' |
| 87 | 87 | ||
| 88 | - # Check if execution of wrong command fails | ||
| 89 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 90 | - 'Self test of test script') | ||
| 91 | - | ||
| 92 | # Check if execution was successful | 88 | # Check if execution was successful |
| 93 | self.test_assert(self._execute(cmd) == 0, | 89 | self.test_assert(self._execute(cmd) == 0, |
| 94 | 'Check successful execution from command line') | 90 | 'Check successful execution from command line') |
| @@ -105,7 +101,7 @@ class Test(test): | @@ -105,7 +101,7 @@ class Test(test): | ||
| 105 | ' logfile="cstsdist_cmd2.log" chatter=2' | 101 | ' logfile="cstsdist_cmd2.log" chatter=2' |
| 106 | 102 | ||
| 107 | # Check if execution failed | 103 | # Check if execution failed |
| 108 | - self.test_assert(self._execute(cmd) != 0, | 104 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 109 | 'Check invalid input file when executed from command line') | 105 | 'Check invalid input file when executed from command line') |
| 110 | 106 | ||
| 111 | # Check cstsdist --help | 107 | # Check cstsdist --help |
test/test_cstsmapmerge.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cstsmapmerge script | 3 | # This scripts performs unit tests for the cstsmapmerge script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -79,10 +79,6 @@ class Test(test): | @@ -79,10 +79,6 @@ class Test(test): | ||
| 79 | ' outmap="cstsmapmerge_cmd1.fits"'+ \ | 79 | ' outmap="cstsmapmerge_cmd1.fits"'+ \ |
| 80 | ' logfile="cstsmapmerge_cmd1.log" chatter=1' | 80 | ' logfile="cstsmapmerge_cmd1.log" chatter=1' |
| 81 | 81 | ||
| 82 | - # Check if execution of wrong command fails | ||
| 83 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 84 | - 'Self test of test script') | ||
| 85 | - | ||
| 86 | # Check if execution was successful | 82 | # Check if execution was successful |
| 87 | self.test_assert(self._execute(cmd) == 0, | 83 | self.test_assert(self._execute(cmd) == 0, |
| 88 | 'Check successful execution from command line') | 84 | 'Check successful execution from command line') |
| @@ -96,7 +92,7 @@ class Test(test): | @@ -96,7 +92,7 @@ class Test(test): | ||
| 96 | ' logfile="cstsmapmerge_cmd2.log" debug=yes chatter=2' | 92 | ' logfile="cstsmapmerge_cmd2.log" debug=yes chatter=2' |
| 97 | 93 | ||
| 98 | # Check if execution failed | 94 | # Check if execution failed |
| 99 | - self.test_assert(self._execute(cmd) != 0, | 95 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 100 | 'Check invalid input file when executed from command line') | 96 | 'Check invalid input file when executed from command line') |
| 101 | 97 | ||
| 102 | # Check cstsmapmerge --help | 98 | # Check cstsmapmerge --help |
test/test_cstsmapsplit.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cstsmapsplit script. | 3 | # This scripts performs unit tests for the cstsmapsplit script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Michael Mayer | 5 | +# Copyright (C) 2016-2018 Michael Mayer |
| 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 |
| @@ -87,10 +87,6 @@ class Test(test): | @@ -87,10 +87,6 @@ class Test(test): | ||
| 87 | ' outfile="cstsmapsplit_cmd1.dat"'+ \ | 87 | ' outfile="cstsmapsplit_cmd1.dat"'+ \ |
| 88 | ' logfile="cstsmapsplit_cmd1.log" chatter=1' | 88 | ' logfile="cstsmapsplit_cmd1.log" chatter=1' |
| 89 | 89 | ||
| 90 | - # Check if execution of wrong command fails | ||
| 91 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 92 | - 'Self test of test script') | ||
| 93 | - | ||
| 94 | # Check if execution was successful | 90 | # Check if execution was successful |
| 95 | self.test_assert(self._execute(cmd) == 0, | 91 | self.test_assert(self._execute(cmd) == 0, |
| 96 | 'Check successful execution from command line') | 92 | 'Check successful execution from command line') |
| @@ -118,7 +114,7 @@ class Test(test): | @@ -118,7 +114,7 @@ class Test(test): | ||
| 118 | ' logfile="cstsmapsplit_cmd2.log" debug=yes chatter=2' | 114 | ' logfile="cstsmapsplit_cmd2.log" debug=yes chatter=2' |
| 119 | 115 | ||
| 120 | # Check if execution failed | 116 | # Check if execution failed |
| 121 | - self.test_assert(self._execute(cmd) != 0, | 117 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 122 | 'Check invalid input file when executed from command line') | 118 | 'Check invalid input file when executed from command line') |
| 123 | 119 | ||
| 124 | # Check cstsmapsplit --help | 120 | # Check cstsmapsplit --help |
test/test_csviscube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csviscube script | 3 | # This scripts performs unit tests for the csviscube script |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -70,10 +70,6 @@ class Test(test): | @@ -70,10 +70,6 @@ class Test(test): | ||
| 70 | ' geolat=-24.6272 binsz=10.0 outfile=csviscube_cmd1.fits'+\ | 70 | ' geolat=-24.6272 binsz=10.0 outfile=csviscube_cmd1.fits'+\ |
| 71 | ' logfile="csviscube_cmd1.log" chatter=1' | 71 | ' logfile="csviscube_cmd1.log" chatter=1' |
| 72 | 72 | ||
| 73 | - # Check if execution of wrong command fails | ||
| 74 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 75 | - 'Self test of test script') | ||
| 76 | - | ||
| 77 | # Check if execution was successful | 73 | # Check if execution was successful |
| 78 | self.test_assert(self._execute(cmd) == 0, | 74 | self.test_assert(self._execute(cmd) == 0, |
| 79 | 'Check successful execution from command line') | 75 | 'Check successful execution from command line') |
test/test_csworkflow.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csworkflow script. | 3 | # This scripts performs unit tests for the csworkflow script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -78,10 +78,6 @@ class Test(test): | @@ -78,10 +78,6 @@ class Test(test): | ||
| 78 | cmd = csworkflow+' inflow="'+self._workflow+'"'+ \ | 78 | cmd = csworkflow+' inflow="'+self._workflow+'"'+ \ |
| 79 | ' logfile="csworkflow_cmd1.log" chatter=1' | 79 | ' logfile="csworkflow_cmd1.log" chatter=1' |
| 80 | 80 | ||
| 81 | - # Check if execution of wrong command fails | ||
| 82 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 83 | - 'Self test of test script') | ||
| 84 | - | ||
| 85 | # Check if execution was successful | 81 | # Check if execution was successful |
| 86 | self.test_assert(self._execute(cmd) == 0, | 82 | self.test_assert(self._execute(cmd) == 0, |
| 87 | 'Check successful execution from command line') | 83 | 'Check successful execution from command line') |
test/test_ctbin.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctbin tool. | 3 | # This scripts performs unit tests for the ctbin tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -77,10 +77,6 @@ class Test(test): | @@ -77,10 +77,6 @@ class Test(test): | ||
| 77 | ' xref=83.63 yref=22.01 proj="CAR"'+ \ | 77 | ' xref=83.63 yref=22.01 proj="CAR"'+ \ |
| 78 | ' logfile="ctbin_cmd1.log" chatter=1' | 78 | ' logfile="ctbin_cmd1.log" chatter=1' |
| 79 | 79 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 80 | # Check if execution was successful |
| 85 | self.test_value(self._execute(cmd), 0, | 81 | self.test_value(self._execute(cmd), 0, |
| 86 | 'Check successful execution from command line') | 82 | 'Check successful execution from command line') |
| @@ -98,7 +94,7 @@ class Test(test): | @@ -98,7 +94,7 @@ class Test(test): | ||
| 98 | ' logfile="ctbin_cmd2.log" debug=yes chatter=1' | 94 | ' logfile="ctbin_cmd2.log" debug=yes chatter=1' |
| 99 | 95 | ||
| 100 | # Check if execution failed | 96 | # Check if execution failed |
| 101 | - self.test_assert(self._execute(cmd) != 0, | 97 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 102 | 'Check invalid input file when executed from command line') | 98 | 'Check invalid input file when executed from command line') |
| 103 | 99 | ||
| 104 | # Setup ctbin command with different ebounds than input | 100 | # Setup ctbin command with different ebounds than input |
test/test_ctbkgcube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctbkgcube tool. | 3 | # This scripts performs unit tests for the ctbkgcube tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -77,10 +77,6 @@ class Test(test): | @@ -77,10 +77,6 @@ class Test(test): | ||
| 77 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ | 77 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ |
| 78 | ' logfile="ctbkgcube_cmd1.log" chatter=1' | 78 | ' logfile="ctbkgcube_cmd1.log" chatter=1' |
| 79 | 79 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 80 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 81 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 82 | 'Check successful execution from command line') |
| @@ -101,7 +97,7 @@ class Test(test): | @@ -101,7 +97,7 @@ class Test(test): | ||
| 101 | ' logfile="ctbkgcube_cmd2.log" debug=yes chatter=1' | 97 | ' logfile="ctbkgcube_cmd2.log" debug=yes chatter=1' |
| 102 | 98 | ||
| 103 | # Check if execution failed | 99 | # Check if execution failed |
| 104 | - self.test_assert(self._execute(cmd) != 0, | 100 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 105 | 'Check invalid input file when executed from command line') | 101 | 'Check invalid input file when executed from command line') |
| 106 | 102 | ||
| 107 | # Check ctbkgcube --help | 103 | # Check ctbkgcube --help |
test/test_ctbutterfly.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctbutterfly tool. | 3 | # This scripts performs unit tests for the ctbutterfly tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Michal Mayer | 5 | +# Copyright (C) 2014-2018 Michal Mayer |
| 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 |
| @@ -72,10 +72,6 @@ class Test(test): | @@ -72,10 +72,6 @@ class Test(test): | ||
| 72 | ' emin=0.1 emax=100.0'+ \ | 72 | ' emin=0.1 emax=100.0'+ \ |
| 73 | ' logfile="ctbutterfly_cmd1.log" chatter=1' | 73 | ' logfile="ctbutterfly_cmd1.log" chatter=1' |
| 74 | 74 | ||
| 75 | - # Check if execution of wrong command fails | ||
| 76 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 77 | - 'Self test of test script') | ||
| 78 | - | ||
| 79 | # Check if execution was successful | 75 | # Check if execution was successful |
| 80 | self.test_assert(self._execute(cmd) == 0, | 76 | self.test_assert(self._execute(cmd) == 0, |
| 81 | 'Check successful execution from command line') | 77 | 'Check successful execution from command line') |
| @@ -92,7 +88,7 @@ class Test(test): | @@ -92,7 +88,7 @@ class Test(test): | ||
| 92 | ' logfile="ctbutterfly_cmd2.log" debug=yes chatter=1' | 88 | ' logfile="ctbutterfly_cmd2.log" debug=yes chatter=1' |
| 93 | 89 | ||
| 94 | # Check if execution failed | 90 | # Check if execution failed |
| 95 | - self.test_assert(self._execute(cmd) != 0, | 91 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 96 | 'Check invalid input file when executed from command line') | 92 | 'Check invalid input file when executed from command line') |
| 97 | 93 | ||
| 98 | # Check ctbutterfly --help | 94 | # Check ctbutterfly --help |
test/test_ctcubemask.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctcubemask tool. | 3 | # This scripts performs unit tests for the ctcubemask tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -76,10 +76,6 @@ class Test(test): | @@ -76,10 +76,6 @@ class Test(test): | ||
| 76 | ' emin=0.1 emax=100.0'+ \ | 76 | ' emin=0.1 emax=100.0'+ \ |
| 77 | ' logfile="ctcubemask_cmd1.log" chatter=1' | 77 | ' logfile="ctcubemask_cmd1.log" chatter=1' |
| 78 | 78 | ||
| 79 | - # Check if execution of wrong command fails | ||
| 80 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 81 | - 'Self test of test script') | ||
| 82 | - | ||
| 83 | # Check if execution was successful | 79 | # Check if execution was successful |
| 84 | self.test_assert(self._execute(cmd) == 0, | 80 | self.test_assert(self._execute(cmd) == 0, |
| 85 | 'Check successful execution from command line') | 81 | 'Check successful execution from command line') |
| @@ -96,7 +92,7 @@ class Test(test): | @@ -96,7 +92,7 @@ class Test(test): | ||
| 96 | ' logfile="ctcubemask_cmd2.log" debug=yes chatter=2' | 92 | ' logfile="ctcubemask_cmd2.log" debug=yes chatter=2' |
| 97 | 93 | ||
| 98 | # Check if execution failed | 94 | # Check if execution failed |
| 99 | - self.test_assert(self._execute(cmd) != 0, | 95 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 100 | 'Check invalid input file when executed from command line') | 96 | 'Check invalid input file when executed from command line') |
| 101 | 97 | ||
| 102 | # Check ctcubemask --help | 98 | # Check ctcubemask --help |
test/test_ctedispcube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctedispcube tool. | 3 | # This scripts performs unit tests for the ctedispcube tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Maria Haupt | 5 | +# Copyright (C) 2016-2018 Maria Haupt |
| 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 |
| @@ -76,10 +76,6 @@ class Test(test): | @@ -76,10 +76,6 @@ class Test(test): | ||
| 76 | ' migramax=2.0 migrabins=10'+ \ | 76 | ' migramax=2.0 migrabins=10'+ \ |
| 77 | ' logfile="ctedispcube_cmd1.log" chatter=1' | 77 | ' logfile="ctedispcube_cmd1.log" chatter=1' |
| 78 | 78 | ||
| 79 | - # Check if execution of wrong command fails | ||
| 80 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 81 | - 'Self test of test script') | ||
| 82 | - | ||
| 83 | # Check if execution was successful | 79 | # Check if execution was successful |
| 84 | self.test_assert(self._execute(cmd) == 0, | 80 | self.test_assert(self._execute(cmd) == 0, |
| 85 | 'Check successful execution from command line') | 81 | 'Check successful execution from command line') |
| @@ -99,7 +95,7 @@ class Test(test): | @@ -99,7 +95,7 @@ class Test(test): | ||
| 99 | ' logfile="ctedispcube_cmd2.log" debug=yes chatter=2' | 95 | ' logfile="ctedispcube_cmd2.log" debug=yes chatter=2' |
| 100 | 96 | ||
| 101 | # Check if execution failed | 97 | # Check if execution failed |
| 102 | - self.test_assert(self._execute(cmd) != 0, | 98 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 103 | 'Check invalid input file when executed from command line') | 99 | 'Check invalid input file when executed from command line') |
| 104 | 100 | ||
| 105 | # Check ctedispcube --help | 101 | # Check ctedispcube --help |
test/test_cterror.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cterror tool. | 3 | # This scripts performs unit tests for the cterror tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2015-2017 Florent Forest | 5 | +# Copyright (C) 2015-2018 Florent Forest |
| 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 |
| @@ -71,10 +71,6 @@ class Test(test): | @@ -71,10 +71,6 @@ class Test(test): | ||
| 71 | ' outmodel="cterror_cmd1.xml"'+ \ | 71 | ' outmodel="cterror_cmd1.xml"'+ \ |
| 72 | ' logfile="cterror_cmd1.log" chatter=1' | 72 | ' logfile="cterror_cmd1.log" chatter=1' |
| 73 | 73 | ||
| 74 | - # Check if execution of wrong command fails | ||
| 75 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 76 | - 'Self test of test script') | ||
| 77 | - | ||
| 78 | # Check if execution was successful | 74 | # Check if execution was successful |
| 79 | self.test_assert(self._execute(cmd) == 0, | 75 | self.test_assert(self._execute(cmd) == 0, |
| 80 | 'Check successful execution from command line') | 76 | 'Check successful execution from command line') |
| @@ -90,7 +86,7 @@ class Test(test): | @@ -90,7 +86,7 @@ class Test(test): | ||
| 90 | ' logfile="cterror_cmd2.log" debug=yes chatter=1' | 86 | ' logfile="cterror_cmd2.log" debug=yes chatter=1' |
| 91 | 87 | ||
| 92 | # Check if execution failed | 88 | # Check if execution failed |
| 93 | - self.test_assert(self._execute(cmd) != 0, | 89 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 94 | 'Check invalid input file when executed from command line') | 90 | 'Check invalid input file when executed from command line') |
| 95 | 91 | ||
| 96 | # Check cterror --help | 92 | # Check cterror --help |
test/test_ctexpcube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctexpcube tool. | 3 | # This scripts performs unit tests for the ctexpcube tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -75,10 +75,6 @@ class Test(test): | @@ -75,10 +75,6 @@ class Test(test): | ||
| 75 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ | 75 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ |
| 76 | ' logfile="ctexpcube_cmd1.log" chatter=1' | 76 | ' logfile="ctexpcube_cmd1.log" chatter=1' |
| 77 | 77 | ||
| 78 | - # Check if execution of wrong command fails | ||
| 79 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 80 | - 'Self test of test script') | ||
| 81 | - | ||
| 82 | # Check if execution was successful | 78 | # Check if execution was successful |
| 83 | self.test_assert(self._execute(cmd) == 0, | 79 | self.test_assert(self._execute(cmd) == 0, |
| 84 | 'Check successful execution from command line') | 80 | 'Check successful execution from command line') |
| @@ -97,7 +93,7 @@ class Test(test): | @@ -97,7 +93,7 @@ class Test(test): | ||
| 97 | ' logfile="ctexpcube_cmd2.log" debug=yes chatter=1' | 93 | ' logfile="ctexpcube_cmd2.log" debug=yes chatter=1' |
| 98 | 94 | ||
| 99 | # Check if execution failed | 95 | # Check if execution failed |
| 100 | - self.test_assert(self._execute(cmd) != 0, | 96 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 101 | 'Check invalid input file when executed from command line') | 97 | 'Check invalid input file when executed from command line') |
| 102 | 98 | ||
| 103 | # Check ctexpcube --help | 99 | # Check ctexpcube --help |
test/test_ctlike.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctlike tool. | 3 | # This scripts performs unit tests for the ctlike tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -71,10 +71,6 @@ class Test(test): | @@ -71,10 +71,6 @@ class Test(test): | ||
| 71 | ' outmodel="ctlike_cmd1.xml"'+ \ | 71 | ' outmodel="ctlike_cmd1.xml"'+ \ |
| 72 | ' logfile="ctlike_cmd1.log" chatter=1' | 72 | ' logfile="ctlike_cmd1.log" chatter=1' |
| 73 | 73 | ||
| 74 | - # Check if execution of wrong command fails | ||
| 75 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 76 | - 'Self test of test script') | ||
| 77 | - | ||
| 78 | # Check if execution was successful | 74 | # Check if execution was successful |
| 79 | self.test_assert(self._execute(cmd) == 0, | 75 | self.test_assert(self._execute(cmd) == 0, |
| 80 | 'Check successful execution from command line') | 76 | 'Check successful execution from command line') |
| @@ -90,7 +86,7 @@ class Test(test): | @@ -90,7 +86,7 @@ class Test(test): | ||
| 90 | ' logfile="ctlike_cmd2.log" debug=yes chatter=1' | 86 | ' logfile="ctlike_cmd2.log" debug=yes chatter=1' |
| 91 | 87 | ||
| 92 | # Check if execution failed | 88 | # Check if execution failed |
| 93 | - self.test_assert(self._execute(cmd) != 0, | 89 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 94 | 'Check invalid input file when executed from command line') | 90 | 'Check invalid input file when executed from command line') |
| 95 | 91 | ||
| 96 | # Check ctlike --help | 92 | # Check ctlike --help |
test/test_ctmapcube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctmapcube tool. | 3 | # This scripts performs unit tests for the ctmapcube tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2018 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 |
| @@ -77,10 +77,6 @@ class Test(test): | @@ -77,10 +77,6 @@ class Test(test): | ||
| 77 | ' xref=83.63 yref=22.01 proj=CAR'+ \ | 77 | ' xref=83.63 yref=22.01 proj=CAR'+ \ |
| 78 | ' logfile="ctmapcube_cmd1.log" chatter=1' | 78 | ' logfile="ctmapcube_cmd1.log" chatter=1' |
| 79 | 79 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 80 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 81 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 82 | 'Check successful execution from command line') |
| @@ -97,7 +93,7 @@ class Test(test): | @@ -97,7 +93,7 @@ class Test(test): | ||
| 97 | ' logfile="ctmapcube_cmd2.log" debug=yes ' | 93 | ' logfile="ctmapcube_cmd2.log" debug=yes ' |
| 98 | 94 | ||
| 99 | # Check if execution failed | 95 | # Check if execution failed |
| 100 | - self.test_assert(self._execute(cmd) != 0, | 96 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 101 | 'Check invalid input file when executed from command line') | 97 | 'Check invalid input file when executed from command line') |
| 102 | 98 | ||
| 103 | # Check ctmapcube --help | 99 | # Check ctmapcube --help |
test/test_ctmodel.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctmodel tool. | 3 | # This scripts performs unit tests for the ctmodel tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -77,10 +77,6 @@ class Test(test): | @@ -77,10 +77,6 @@ class Test(test): | ||
| 77 | ' xref=83.63 yref=22.01'+ \ | 77 | ' xref=83.63 yref=22.01'+ \ |
| 78 | ' logfile="ctmodel_cmd1.log" chatter=1' | 78 | ' logfile="ctmodel_cmd1.log" chatter=1' |
| 79 | 79 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 80 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 81 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 82 | 'Check successful execution from command line') |
| @@ -101,7 +97,7 @@ class Test(test): | @@ -101,7 +97,7 @@ class Test(test): | ||
| 101 | ' logfile="ctmodel_cmd2.log" debug=yes chatter=1' | 97 | ' logfile="ctmodel_cmd2.log" debug=yes chatter=1' |
| 102 | 98 | ||
| 103 | # Check if execution failed | 99 | # Check if execution failed |
| 104 | - self.test_assert(self._execute(cmd) != 0, | 100 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 105 | 'Check invalid input file when executed from command line') | 101 | 'Check invalid input file when executed from command line') |
| 106 | 102 | ||
| 107 | # Check ctmodel --help | 103 | # Check ctmodel --help |
test/test_ctobssim.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctobssim tool | 3 | # This scripts performs unit tests for the ctobssim tool |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -80,10 +80,6 @@ class Test(test): | @@ -80,10 +80,6 @@ class Test(test): | ||
| 80 | ' emin=0.1 emax=100.0'+ \ | 80 | ' emin=0.1 emax=100.0'+ \ |
| 81 | ' logfile="ctobssim_cmd1.log" chatter=1' | 81 | ' logfile="ctobssim_cmd1.log" chatter=1' |
| 82 | 82 | ||
| 83 | - # Check if execution of wrong command fails | ||
| 84 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 85 | - 'Self test of test script') | ||
| 86 | - | ||
| 87 | # Check if execution was successful | 83 | # Check if execution was successful |
| 88 | self.test_assert(self._execute(cmd) == 0, | 84 | self.test_assert(self._execute(cmd) == 0, |
| 89 | 'Check successful execution from command line') | 85 | 'Check successful execution from command line') |
| @@ -103,7 +99,7 @@ class Test(test): | @@ -103,7 +99,7 @@ class Test(test): | ||
| 103 | ' logfile="ctobssim_cmd2.log" debug=yes chatter=1' | 99 | ' logfile="ctobssim_cmd2.log" debug=yes chatter=1' |
| 104 | 100 | ||
| 105 | # Check if execution failed | 101 | # Check if execution failed |
| 106 | - self.test_assert(self._execute(cmd) != 0, | 102 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 107 | 'Check invalid input file when executed from command line') | 103 | 'Check invalid input file when executed from command line') |
| 108 | 104 | ||
| 109 | # Check ctobssim --help | 105 | # Check ctobssim --help |
test/test_ctphase.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctphase tool. | 3 | # This scripts performs unit tests for the ctphase tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 by Joshua Cardenzana | 5 | +# Copyright (C) 2017-2018 by Joshua Cardenzana |
| 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 |
| @@ -75,10 +75,6 @@ class Test(test): | @@ -75,10 +75,6 @@ class Test(test): | ||
| 75 | ' inmodel="'+self._model_file+'" srcname="Crab"'+ \ | 75 | ' inmodel="'+self._model_file+'" srcname="Crab"'+ \ |
| 76 | ' logfile="ctphase_cmd1.log" chatter=1' | 76 | ' logfile="ctphase_cmd1.log" chatter=1' |
| 77 | 77 | ||
| 78 | - # Check if execution of wrong command fails | ||
| 79 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 80 | - 'Self test of test script') | ||
| 81 | - | ||
| 82 | # Check if execution was successful | 78 | # Check if execution was successful |
| 83 | self.test_assert(self._execute(cmd) == 0, | 79 | self.test_assert(self._execute(cmd) == 0, |
| 84 | 'Check successful execution from command line') | 80 | 'Check successful execution from command line') |
| @@ -93,7 +89,7 @@ class Test(test): | @@ -93,7 +89,7 @@ class Test(test): | ||
| 93 | ' logfile="ctphase_cmd2.log" debug=yes chatter=1' | 89 | ' logfile="ctphase_cmd2.log" debug=yes chatter=1' |
| 94 | 90 | ||
| 95 | # Check if execution failed | 91 | # Check if execution failed |
| 96 | - self.test_assert(self._execute(cmd) != 0, | 92 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 97 | 'Check invalid input file when executed from command line') | 93 | 'Check invalid input file when executed from command line') |
| 98 | 94 | ||
| 99 | # Check ctphase --help | 95 | # Check ctphase --help |
test/test_ctprob.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctprob tool. | 3 | # This scripts performs unit tests for the ctprob tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 by Leonardo Di Venere | 5 | +# Copyright (C) 2017-2018 by Leonardo Di Venere |
| 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 |
| @@ -92,7 +92,7 @@ class Test(test): | @@ -92,7 +92,7 @@ class Test(test): | ||
| 92 | ' logfile="ctprob_cmd2.log" debug=yes chatter=1' | 92 | ' logfile="ctprob_cmd2.log" debug=yes chatter=1' |
| 93 | 93 | ||
| 94 | # Check if execution failed | 94 | # Check if execution failed |
| 95 | - self.test_assert(self._execute(cmd) != 0, | 95 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 96 | 'Check invalid input file when executed from command line') | 96 | 'Check invalid input file when executed from command line') |
| 97 | 97 | ||
| 98 | # Check ctprob --help | 98 | # Check ctprob --help |
test/test_ctpsfcube.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctpsfcube tool. | 3 | # This scripts performs unit tests for the ctpsfcube tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -76,10 +76,6 @@ class Test(test): | @@ -76,10 +76,6 @@ class Test(test): | ||
| 76 | ' amax=0.3 anumbins=10'+ \ | 76 | ' amax=0.3 anumbins=10'+ \ |
| 77 | ' logfile="ctpsfcube_cmd1.log" chatter=1' | 77 | ' logfile="ctpsfcube_cmd1.log" chatter=1' |
| 78 | 78 | ||
| 79 | - # Check if execution of wrong command fails | ||
| 80 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 81 | - 'Self test of test script') | ||
| 82 | - | ||
| 83 | # Check if execution was successful | 79 | # Check if execution was successful |
| 84 | self.test_assert(self._execute(cmd) == 0, | 80 | self.test_assert(self._execute(cmd) == 0, |
| 85 | 'Check successful execution from command line') | 81 | 'Check successful execution from command line') |
| @@ -99,7 +95,7 @@ class Test(test): | @@ -99,7 +95,7 @@ class Test(test): | ||
| 99 | ' logfile="ctpsfcube_cmd2.log" debug=yes chatter=1' | 95 | ' logfile="ctpsfcube_cmd2.log" debug=yes chatter=1' |
| 100 | 96 | ||
| 101 | # Check if execution failed | 97 | # Check if execution failed |
| 102 | - self.test_assert(self._execute(cmd) != 0, | 98 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 103 | 'Check invalid input file when executed from command line') | 99 | 'Check invalid input file when executed from command line') |
| 104 | 100 | ||
| 105 | # Check ctpsfcube --help | 101 | # Check ctpsfcube --help |
test/test_ctselect.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctselect tool. | 3 | # This scripts performs unit tests for the ctselect tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -77,10 +77,6 @@ class Test(test): | @@ -77,10 +77,6 @@ class Test(test): | ||
| 77 | ' emin=0.2 emax=80.0'+ \ | 77 | ' emin=0.2 emax=80.0'+ \ |
| 78 | ' logfile="ctselect_cmd1.log" chatter=1' | 78 | ' logfile="ctselect_cmd1.log" chatter=1' |
| 79 | 79 | ||
| 80 | - # Check if execution of wrong command fails | ||
| 81 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 82 | - 'Self test of test script') | ||
| 83 | - | ||
| 84 | # Check if execution was successful | 80 | # Check if execution was successful |
| 85 | self.test_assert(self._execute(cmd) == 0, | 81 | self.test_assert(self._execute(cmd) == 0, |
| 86 | 'Check successful execution from command line') | 82 | 'Check successful execution from command line') |
| @@ -97,7 +93,7 @@ class Test(test): | @@ -97,7 +93,7 @@ class Test(test): | ||
| 97 | ' logfile="ctselect_cmd2.log" debug=yes chatter=1' | 93 | ' logfile="ctselect_cmd2.log" debug=yes chatter=1' |
| 98 | 94 | ||
| 99 | # Check if execution failed | 95 | # Check if execution failed |
| 100 | - self.test_assert(self._execute(cmd) != 0, | 96 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 101 | 'Check invalid input file when executed from command line') | 97 | 'Check invalid input file when executed from command line') |
| 102 | 98 | ||
| 103 | # Check ctselect --help | 99 | # Check ctselect --help |
test/test_ctskymap.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctskymap tool. | 3 | # This scripts performs unit tests for the ctskymap tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -73,10 +73,6 @@ class Test(test): | @@ -73,10 +73,6 @@ class Test(test): | ||
| 73 | ' xref=83.63 yref=22.01 bkgsubtract="NONE"'+ \ | 73 | ' xref=83.63 yref=22.01 bkgsubtract="NONE"'+ \ |
| 74 | ' logfile="ctskymap_cmd1.log" chatter=1' | 74 | ' logfile="ctskymap_cmd1.log" chatter=1' |
| 75 | 75 | ||
| 76 | - # Check if execution of wrong command fails | ||
| 77 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 78 | - 'Self test of test script') | ||
| 79 | - | ||
| 80 | # Check if execution was successful | 76 | # Check if execution was successful |
| 81 | self.test_assert(self._execute(cmd) == 0, | 77 | self.test_assert(self._execute(cmd) == 0, |
| 82 | 'Check successful execution from command line') | 78 | 'Check successful execution from command line') |
| @@ -93,7 +89,7 @@ class Test(test): | @@ -93,7 +89,7 @@ class Test(test): | ||
| 93 | ' logfile="ctskymap_cmd2.log" debug=yes chatter=2' | 89 | ' logfile="ctskymap_cmd2.log" debug=yes chatter=2' |
| 94 | 90 | ||
| 95 | # Check if execution failed | 91 | # Check if execution failed |
| 96 | - self.test_assert(self._execute(cmd) != 0, | 92 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 97 | 'Check invalid input file when executed from command line') | 93 | 'Check invalid input file when executed from command line') |
| 98 | 94 | ||
| 99 | # Check ctskymap --help | 95 | # Check ctskymap --help |
test/test_cttsmap.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the cttsmap tool | 3 | # This scripts performs unit tests for the cttsmap tool |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2017 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2018 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 |
| @@ -74,10 +74,6 @@ class Test(test): | @@ -74,10 +74,6 @@ class Test(test): | ||
| 74 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ | 74 | ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \ |
| 75 | ' logfile="cttsmap_cmd1.log" chatter=1' | 75 | ' logfile="cttsmap_cmd1.log" chatter=1' |
| 76 | 76 | ||
| 77 | - # Check if execution of wrong command fails | ||
| 78 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 79 | - 'Self test of test script') | ||
| 80 | - | ||
| 81 | # Check if execution was successful | 77 | # Check if execution was successful |
| 82 | self.test_assert(self._execute(cmd) == 0, | 78 | self.test_assert(self._execute(cmd) == 0, |
| 83 | 'Check successful execution from command line') | 79 | 'Check successful execution from command line') |
| @@ -95,7 +91,7 @@ class Test(test): | @@ -95,7 +91,7 @@ class Test(test): | ||
| 95 | ' logfile="cttsmap_cmd2.log" debug=yes chatter=2' | 91 | ' logfile="cttsmap_cmd2.log" debug=yes chatter=2' |
| 96 | 92 | ||
| 97 | # Check if execution failed | 93 | # Check if execution failed |
| 98 | - self.test_assert(self._execute(cmd) != 0, | 94 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 99 | 'Check invalid input file when executed from command line') | 95 | 'Check invalid input file when executed from command line') |
| 100 | 96 | ||
| 101 | # Setup cttsmap command | 97 | # Setup cttsmap command |
test/test_ctulimit.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the ctulimit tool. | 3 | # This scripts performs unit tests for the ctulimit tool. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2015-2017 Michael Mayer | 5 | +# Copyright (C) 2015-2018 Michael Mayer |
| 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 |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -#import gammalib | ||
| 22 | import ctools | 21 | import ctools |
| 23 | from testing import test | 22 | from testing import test |
| 24 | 23 | ||
| @@ -70,10 +69,6 @@ class Test(test): | @@ -70,10 +69,6 @@ class Test(test): | ||
| 70 | ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ | 69 | ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ |
| 71 | ' logfile="ctulimit_cmd1.log" chatter=1' | 70 | ' logfile="ctulimit_cmd1.log" chatter=1' |
| 72 | 71 | ||
| 73 | - # Check if execution of wrong command fails | ||
| 74 | - self.test_assert(self._execute('command_that_does_not_exist') != 0, | ||
| 75 | - 'Self test of test script') | ||
| 76 | - | ||
| 77 | # Check if execution was successful | 72 | # Check if execution was successful |
| 78 | self.test_assert(self._execute(cmd) == 0, | 73 | self.test_assert(self._execute(cmd) == 0, |
| 79 | 'Check successful execution from command line') | 74 | 'Check successful execution from command line') |
| @@ -85,7 +80,7 @@ class Test(test): | @@ -85,7 +80,7 @@ class Test(test): | ||
| 85 | ' logfile="ctulimit_cmd2.log" debug=yes chatter=2' | 80 | ' logfile="ctulimit_cmd2.log" debug=yes chatter=2' |
| 86 | 81 | ||
| 87 | # Check if execution failed | 82 | # Check if execution failed |
| 88 | - self.test_assert(self._execute(cmd) != 0, | 83 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 89 | 'Check invalid input file when executed from command line') | 84 | 'Check invalid input file when executed from command line') |
| 90 | 85 | ||
| 91 | # Setup ctulimit command | 86 | # Setup ctulimit command |
| @@ -95,7 +90,7 @@ class Test(test): | @@ -95,7 +90,7 @@ class Test(test): | ||
| 95 | ' logfile="ctulimit_cmd2.log" debug=yes chatter=2' | 90 | ' logfile="ctulimit_cmd2.log" debug=yes chatter=2' |
| 96 | 91 | ||
| 97 | # Check if execution failed | 92 | # Check if execution failed |
| 98 | - self.test_assert(self._execute(cmd) != 0, | 93 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 99 | 'Check invalid source name when executed from command line') | 94 | 'Check invalid source name when executed from command line') |
| 100 | 95 | ||
| 101 | # Check ctulimit --help | 96 | # Check ctulimit --help |
test/testing.py.in
| 1 | # ========================================================================== | 1 | # ========================================================================== |
| 2 | # Python base class for unit tests | 2 | # Python base class for unit tests |
| 3 | # | 3 | # |
| 4 | -# Copyright (C) 2016 Juergen Knoedlseder | 4 | +# Copyright (C) 2016-2018 Juergen Knoedlseder |
| 5 | # | 5 | # |
| 6 | # This program is free software: you can redistribute it and/or modify | 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by | 7 | # it under the terms of the GNU General Public License as published by |
| @@ -55,6 +55,16 @@ class test(gammalib.GPythonTestSuite): | @@ -55,6 +55,16 @@ class test(gammalib.GPythonTestSuite): | ||
| 55 | def _script(self, name): | 55 | def _script(self, name): |
| 56 | """ | 56 | """ |
| 57 | Set script name | 57 | Set script name |
| 58 | + | ||
| 59 | + Parameters | ||
| 60 | + ---------- | ||
| 61 | + name : str | ||
| 62 | + Script name | ||
| 63 | + | ||
| 64 | + Returns | ||
| 65 | + ------- | ||
| 66 | + script : str | ||
| 67 | + Script name including path | ||
| 58 | """ | 68 | """ |
| 59 | # Set script name dependent on whether the software is installed or | 69 | # Set script name dependent on whether the software is installed or |
| 60 | # not. If the software is not installed the 'TEST_BUILDDIR' environment | 70 | # not. If the software is not installed the 'TEST_BUILDDIR' environment |
| @@ -72,6 +82,16 @@ class test(gammalib.GPythonTestSuite): | @@ -72,6 +82,16 @@ class test(gammalib.GPythonTestSuite): | ||
| 72 | def _tool(self, name): | 82 | def _tool(self, name): |
| 73 | """ | 83 | """ |
| 74 | Set tool name | 84 | Set tool name |
| 85 | + | ||
| 86 | + Parameters | ||
| 87 | + ---------- | ||
| 88 | + name : str | ||
| 89 | + Tool name | ||
| 90 | + | ||
| 91 | + Returns | ||
| 92 | + ------- | ||
| 93 | + tool : str | ||
| 94 | + Tool name including path | ||
| 75 | """ | 95 | """ |
| 76 | # Set tool name dependent on whether the software is installed or | 96 | # Set tool name dependent on whether the software is installed or |
| 77 | # not. If the software is not installed the 'TEST_BUILDDIR' environment | 97 | # not. If the software is not installed the 'TEST_BUILDDIR' environment |
| @@ -85,16 +105,39 @@ class test(gammalib.GPythonTestSuite): | @@ -85,16 +105,39 @@ class test(gammalib.GPythonTestSuite): | ||
| 85 | return tool | 105 | return tool |
| 86 | 106 | ||
| 87 | # Execute command and catch any exception | 107 | # Execute command and catch any exception |
| 88 | - def _execute(self, cmd): | 108 | + def _execute(self, cmd, success=True): |
| 89 | """ | 109 | """ |
| 90 | Execute command | 110 | Execute command |
| 111 | + | ||
| 112 | + Parameters | ||
| 113 | + ---------- | ||
| 114 | + cmd : str | ||
| 115 | + Command string to be executed | ||
| 116 | + success : bool | ||
| 117 | + True if success is expected, False otherwise | ||
| 118 | + | ||
| 119 | + Returns | ||
| 120 | + ------- | ||
| 121 | + rc : int | ||
| 122 | + Return code | ||
| 91 | """ | 123 | """ |
| 92 | # Execute command, make sure we catch any exception | 124 | # Execute command, make sure we catch any exception |
| 93 | try: | 125 | try: |
| 94 | - rc = os.system(cmd+' >/dev/null 2>&1') | 126 | + rc = os.system(cmd+' > ctools_test_output.dmp 2>&1') |
| 95 | except: | 127 | except: |
| 96 | rc = -1 | 128 | rc = -1 |
| 97 | 129 | ||
| 130 | + # If an exception occured then put output on screen | ||
| 131 | + if success and rc != 0 or not success and rc == 0: | ||
| 132 | + print('\n*** Unexpected exception (%d) for command %s:' % (rc, cmd)) | ||
| 133 | + f = open('ctools_test_output.dmp', 'r') | ||
| 134 | + for line in f: | ||
| 135 | + print(line.rstrip('\n')) | ||
| 136 | + f.close() | ||
| 137 | + | ||
| 138 | + # Remove test output | ||
| 139 | + os.remove('ctools_test_output.dmp') | ||
| 140 | + | ||
| 98 | # Return return code | 141 | # Return return code |
| 99 | return rc | 142 | return rc |
| 100 | 143 | ||
| @@ -105,7 +148,7 @@ class test(gammalib.GPythonTestSuite): | @@ -105,7 +148,7 @@ class test(gammalib.GPythonTestSuite): | ||
| 105 | 148 | ||
| 106 | Returns | 149 | Returns |
| 107 | ------- | 150 | ------- |
| 108 | - obs : `~gammalib.gammalib.GObservations` | 151 | + obs : `~gammalib.GObservations` |
| 109 | Observations container | 152 | Observations container |
| 110 | """ | 153 | """ |
| 111 | # Load CTA event list | 154 | # Load CTA event list |
| @@ -138,7 +181,7 @@ class test(gammalib.GPythonTestSuite): | @@ -138,7 +181,7 @@ class test(gammalib.GPythonTestSuite): | ||
| 138 | 181 | ||
| 139 | Returns | 182 | Returns |
| 140 | ------- | 183 | ------- |
| 141 | - obs : `~gammalib.gammalib.GObservations` | 184 | + obs : `~gammalib.GObservations` |
| 142 | Observations container | 185 | Observations container |
| 143 | """ | 186 | """ |
| 144 | # Load CTA event list | 187 | # Load CTA event list |
| @@ -168,6 +211,12 @@ class test(gammalib.GPythonTestSuite): | @@ -168,6 +211,12 @@ class test(gammalib.GPythonTestSuite): | ||
| 168 | # Check | 211 | # Check |
| 169 | def _check_help(self, tool): | 212 | def _check_help(self, tool): |
| 170 | """ | 213 | """ |
| 214 | + Check for help text | ||
| 215 | + | ||
| 216 | + Parameters | ||
| 217 | + ---------- | ||
| 218 | + name : str | ||
| 219 | + Tool name | ||
| 171 | """ | 220 | """ |
| 172 | # Setup tool --help option | 221 | # Setup tool --help option |
| 173 | cmd = tool+' --help' | 222 | cmd = tool+' --help' |
| @@ -178,7 +227,7 @@ class test(gammalib.GPythonTestSuite): | @@ -178,7 +227,7 @@ class test(gammalib.GPythonTestSuite): | ||
| 178 | self.test_value(self._execute(cmd), 0, | 227 | self.test_value(self._execute(cmd), 0, |
| 179 | 'Check successful execution with --help option') | 228 | 'Check successful execution with --help option') |
| 180 | else: | 229 | else: |
| 181 | - self.test_assert(self._execute(cmd) != 0, | 230 | + self.test_assert(self._execute(cmd, success=False) != 0, |
| 182 | 'Check execution failure with --help option') | 231 | 'Check execution failure with --help option') |
| 183 | 232 | ||
| 184 | # Return | 233 | # Return |