Commit d7c71736d5adc40b323e65a64087786c3c050186

Authored by Jürgen Knödlseder
1 parent 27087654

In case of an error, test output is now written into log file (#2264).

ChangeLog
... ... @@ -13,6 +13,7 @@
13 13 Support On/Off analysis in cslightcrv and csphasecrv (#2273)
14 14 ctselect informs about non-overlapping time interval (#2272)
15 15 Add tutorial for classical analysis (#2267)
  16 + In case of an error, test output is now written into log file (#2264)
16 17 Fix chatter level handling in ctpsfcube (#2262)
17 18 Handle On/Off observations by cspull (#2260)
18 19 Add "statistic" parameter to all likelihood tools and scripts (#2237)
... ...
... ... @@ -9,6 +9,8 @@ ctools release with respect to the precedent release.
9 9  
10 10 Configuration
11 11 -------------
  12 +In case of an error, test output is now written into log file (#2264).
  13 +
12 14 The cscripts::execute() method no longer creates log files, making the
13 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 39 :ref:`ctselect` informs about non-overlapping time interval
40 40 * [`2267 <https://cta-redmine.irap.omp.eu/issues/2267>`_] -
41 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 44 * [`2260 <https://cta-redmine.irap.omp.eu/issues/2260>`_] -
43 45 Handle On/Off observations by :ref:`cspull`
44 46 * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
... ...
test/test_cscaldb.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -68,10 +68,6 @@ class Test(test):
68 68 # Setup cscaldb command
69 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 71 # Check if execution was successful
76 72 self.test_assert(self._execute(cmd) == 0,
77 73 'Check successful execution from command line')
... ...
test/test_csebins.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -75,10 +75,6 @@ class Test(test):
75 75 ' outfile="csebins_cmd1.fits"'+ \
76 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 78 # Check if execution was successful
83 79 self.test_assert(self._execute(cmd) == 0,
84 80 'Check successful execution from command line')
... ... @@ -94,7 +90,7 @@ class Test(test):
94 90 ' logfile="csebins_cmd2.log" debug=yes chatter=1'
95 91  
96 92 # Check if execution failed
97   - self.test_assert(self._execute(cmd) != 0,
  93 + self.test_assert(self._execute(cmd, success=False) != 0,
98 94 'Check invalid input file when executed from command line')
99 95  
100 96 # Check csebins --help
... ...
test/test_csfindobs.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -78,10 +78,6 @@ class Test(test):
78 78 ' outfile="runlist_cmd1.dat"'+ \
79 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 81 # Check if execution was successful
86 82 self.test_assert(self._execute(cmd) == 0,
87 83 'Check successful execution from command line')
... ... @@ -97,7 +93,7 @@ class Test(test):
97 93 ' logfile="csfindobs_cmd2.log" debug=yes'
98 94  
99 95 # Check if execution failed
100   - self.test_assert(self._execute(cmd) != 0,
  96 + self.test_assert(self._execute(cmd, success=False) != 0,
101 97 'Check invalid input file when executed from command line')
102 98  
103 99 # Check csfindobs --help
... ...
test/test_csiactcopy.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -80,10 +80,6 @@ class Test(test):
80 80 ' outpath="csiactcopy_cmd1"'+ \
81 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 83 # Check if execution was successful
88 84 self.test_assert(self._execute(cmd) == 0,
89 85 'Check successful execution from command line')
... ... @@ -98,7 +94,7 @@ class Test(test):
98 94 ' logfile="csiactcopy_cmd2.log" debug=yes'
99 95  
100 96 # Check if execution failed
101   - self.test_assert(self._execute(cmd) != 0,
  97 + self.test_assert(self._execute(cmd, success=False) != 0,
102 98 'Check invalid input file when executed from command line')
103 99  
104 100 # Check csiactcopy --help
... ...
test/test_csiactdata.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -75,10 +75,6 @@ class Test(test):
75 75 cmd = csiactdata+' datapath="'+self._datapath+'"'+ \
76 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 78 # Check if execution was successful
83 79 self.test_assert(self._execute(cmd) == 0,
84 80 'Check successful execution from command line')
... ... @@ -88,7 +84,7 @@ class Test(test):
88 84 ' logfile="csiactdata_cmd2.log" debug=yes'
89 85  
90 86 # Check if execution failed
91   - self.test_assert(self._execute(cmd) != 0,
  87 + self.test_assert(self._execute(cmd, success=False) != 0,
92 88 'Check invalid input file when executed from command line')
93 89  
94 90 # Check csiactdata --help
... ...
test/test_csiactobs.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -81,10 +81,6 @@ class Test(test):
81 81 ' outmodel="csiactobs_bgd_cmd1.xml"'+ \
82 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 84 # Check if execution was successful
89 85 self.test_assert(self._execute(cmd) == 0,
90 86 'Check successful execution from command line')
... ... @@ -106,7 +102,7 @@ class Test(test):
106 102 ' chatter=1'
107 103  
108 104 # Check if execution failed
109   - self.test_assert(self._execute(cmd) != 0,
  105 + self.test_assert(self._execute(cmd, success=False) != 0,
110 106 'Check invalid input datapath when executed from command line')
111 107  
112 108 # Setup csiactobs command
... ... @@ -120,7 +116,7 @@ class Test(test):
120 116 ' chatter=1'
121 117  
122 118 # Check if execution failed
123   - self.test_assert(self._execute(cmd) != 0,
  119 + self.test_assert(self._execute(cmd, success=False) != 0,
124 120 'Check invalid input prodname when executed from command line')
125 121  
126 122 # Check csiactobs --help
... ...
test/test_csinfo.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -18,8 +18,6 @@
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19 #
20 20 # ==========================================================================
21   -#import gammalib
22   -#import cscripts
23 21 from testing import test
24 22  
25 23  
... ... @@ -67,10 +65,6 @@ class Test(test):
67 65 # Setup csinfo command
68 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 68 # Execute script without arguments
75 69 self.test_assert(self._execute(cmd) == 0,
76 70 'Check successful execution from command line')
... ... @@ -88,9 +82,10 @@ class Test(test):
88 82 'Check successful execution with "info" argument from command line')
89 83  
90 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 90 # Return
96 91 return
... ...
test/test_cslightcrv.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -82,10 +82,6 @@ class Test(test):
82 82 ' outfile="lightcurve_cmd1.fits"'+ \
83 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 85 # Check if execution was successful
90 86 self.test_assert(self._execute(cmd) == 0,
91 87 'Check successful execution from command line')
... ... @@ -104,7 +100,7 @@ class Test(test):
104 100 ' logfile="cslightcrv_cmd2.log" debug=yes'
105 101  
106 102 # Check if execution failed
107   - self.test_assert(self._execute(cmd) != 0,
  103 + self.test_assert(self._execute(cmd, success=False) != 0,
108 104 'Check invalid input file when executed from command line')
109 105  
110 106 # Check cslightcrv --help
... ...
test/test_csmodelinfo.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -18,7 +18,6 @@
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19 #
20 20 # ==========================================================================
21   -#import gammalib
22 21 import cscripts
23 22 from testing import test
24 23  
... ... @@ -77,10 +76,6 @@ class Test(test):
77 76 ' outds9file="csmodelinfo_cmd1.reg"'+ \
78 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 79 # Check if execution was successful
85 80 self.test_assert(self._execute(cmd) == 0,
86 81 'Check successful execution from command line')
... ... @@ -94,7 +89,7 @@ class Test(test):
94 89 ' logfile="csmodelinfo_cmd2.log" debug=yes'
95 90  
96 91 # Check if execution failed
97   - self.test_assert(self._execute(cmd) != 0,
  92 + self.test_assert(self._execute(cmd, success=False) != 0,
98 93 'Check invalid input file when executed from command line')
99 94  
100 95 # Check csmodelinfo --help
... ...
test/test_csmodelmerge.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -79,10 +79,6 @@ class Test(test):
79 79 ' outmodel="csmodelmerge_cmd1.xml"'+ \
80 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 82 # Check if execution was successful
87 83 self.test_assert(self._execute(cmd) == 0,
88 84 'Check successful execution from command line')
... ... @@ -96,7 +92,7 @@ class Test(test):
96 92 ' logfile="csmodelmerge_cmd2.log" debug=yes'
97 93  
98 94 # Check if execution failed
99   - self.test_assert(self._execute(cmd) != 0,
  95 + self.test_assert(self._execute(cmd, success=False) != 0,
100 96 'Check invalid input file when executed from command line')
101 97  
102 98 # Check csmodelmerge --help
... ...
test/test_csmodelselect.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -74,10 +74,6 @@ class Test(test):
74 74 ' outmodel="csmodelselect_cmd1.xml"'+ \
75 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 77 # Check if execution was successful
82 78 self.test_assert(self._execute(cmd) == 0,
83 79 'Check successful execution from command line')
... ... @@ -92,7 +88,7 @@ class Test(test):
92 88 ' logfile="csmodelselect_cmd2.log" debug=yes'
93 89  
94 90 # Check if execution failed
95   - self.test_assert(self._execute(cmd) != 0,
  91 + self.test_assert(self._execute(cmd, success=False) != 0,
96 92 'Check invalid input file when executed from command line')
97 93  
98 94 # Check csmodelselect --help
... ...
test/test_csmodelsois.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -78,10 +78,6 @@ class Test(test):
78 78 ' ra=83.63 dec=22.01 proj=CAR'+ \
79 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 81 # Check if execution was successful
86 82 self.test_assert(self._execute(cmd) == 0,
87 83 'Check successful execution from command line')
... ... @@ -99,7 +95,7 @@ class Test(test):
99 95 ' logfile="csmodelsois_cmd2.log" debug=yes'
100 96  
101 97 # Check if execution failed
102   - self.test_assert(self._execute(cmd) != 0,
  98 + self.test_assert(self._execute(cmd, success=False) != 0,
103 99 'Check invalid input file when executed from command line')
104 100  
105 101 # Check csmodelsois --help
... ...
test/test_csobs2caldb.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -81,10 +81,6 @@ class Test(test):
81 81 ' caldb="cta" irf="Cmd1" rootdir="caldb"'+ \
82 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 84 # Check if execution was successful
89 85 self.test_assert(self._execute(cmd) == 0,
90 86 'Check successful execution from command line')
... ... @@ -98,7 +94,7 @@ class Test(test):
98 94 ' logfile="csobs2caldb_cmd2.log" debug=yes'
99 95  
100 96 # Check if execution failed
101   - self.test_assert(self._execute(cmd) != 0,
  97 + self.test_assert(self._execute(cmd, success=False) != 0,
102 98 'Check invalid input file when executed from command line')
103 99  
104 100 # Check csobs2caldb --help
... ...
test/test_csobsdef.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -79,10 +79,6 @@ class Test(test):
79 79 ' emin=0.1 emax=100.0 duration=1800.0 rad=5.0'+ \
80 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 82 # Check if execution was successful
87 83 self.test_assert(self._execute(cmd) == 0,
88 84 'Check successful execution from command line')
... ... @@ -98,7 +94,7 @@ class Test(test):
98 94 ' logfile="csobsdef_cmd2.log" debug=yes'
99 95  
100 96 # Check if execution failed
101   - self.test_assert(self._execute(cmd) != 0,
  97 + self.test_assert(self._execute(cmd, success=False) != 0,
102 98 'Check invalid input file when executed from command line')
103 99  
104 100 # Check csobsdef --help
... ...
test/test_csobsinfo.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -18,7 +18,6 @@
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19 #
20 20 # ==========================================================================
21   -#import gammalib
22 21 import cscripts
23 22 from testing import test
24 23  
... ... @@ -77,10 +76,6 @@ class Test(test):
77 76 ' offset=yes ra=83.63 dec=22.01'+ \
78 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 79 # Check if execution was successful
85 80 self.test_assert(self._execute(cmd) == 0,
86 81 'Check successful execution from command line')
... ... @@ -95,7 +90,7 @@ class Test(test):
95 90 ' logfile="csobsinfo_cmd2.log" debug=yes'
96 91  
97 92 # Check if execution failed
98   - self.test_assert(self._execute(cmd) != 0,
  93 + self.test_assert(self._execute(cmd, success=False) != 0,
99 94 'Check invalid input file when executed from command line')
100 95  
101 96 # Check csobsinfo --help
... ...
test/test_csobsselect.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -75,10 +75,6 @@ class Test(test):
75 75 ' dec=22.01 rad=5.0'+ \
76 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 78 # Check if execution was successful
83 79 self.test_assert(self._execute(cmd) == 0,
84 80 'Check successful execution from command line')
... ... @@ -94,7 +90,7 @@ class Test(test):
94 90 ' logfile="csobsselect_cmd2.log" debug=yes chatter=2'
95 91  
96 92 # Check if execution failed
97   - self.test_assert(self._execute(cmd) != 0,
  93 + self.test_assert(self._execute(cmd, success=False) != 0,
98 94 'Check invalid input file when executed from command line')
99 95  
100 96 # Check csobsselect --help
... ...
test/test_csphagen.py
... ... @@ -93,10 +93,6 @@ class Test(test):
93 93 'outobs="csphagen_cmd1.xml" prefix="csphagen_cmd1" ' + \
94 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 96 # Check if execution was successful
101 97 self.test_assert(self._execute(cmd) == 0,
102 98 'Check successful execution from command line')
... ... @@ -119,8 +115,8 @@ class Test(test):
119 115 'logfile="csphagen_cmd2.log" debug=yes chatter=1'
120 116  
121 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 121 # Check csphagen --help
126 122 self._check_help(csphagen)
... ...
test/test_csphasecrv.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -82,10 +82,6 @@ class Test(test):
82 82 ' outfile="csphasecrv_cmd1.fits"'+ \
83 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 85 # Check if execution was successful
90 86 self.test_assert(self._execute(cmd) == 0,
91 87 'Check successful execution from command line')
... ... @@ -103,7 +99,7 @@ class Test(test):
103 99 ' logfile="csphasecrv_cmd2.log" debug=yes chatter=1'
104 100  
105 101 # Check if execution failed
106   - self.test_assert(self._execute(cmd) != 0,
  102 + self.test_assert(self._execute(cmd, success=False) != 0,
107 103 'Check invalid input file when executed from command line')
108 104  
109 105 # Check csphasecrv --help
... ...
test/test_cspull.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -84,10 +84,6 @@ class Test(test):
84 84 ' npix=200 binsz=0.05'+ \
85 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 87 # Check if execution was successful
92 88 self.test_assert(self._execute(cmd) == 0,
93 89 'Check successful execution from command line')
... ... @@ -106,7 +102,7 @@ class Test(test):
106 102 ' logfile="cspull_cmd2.log" debug=yes'
107 103  
108 104 # Check if execution failed
109   - self.test_assert(self._execute(cmd) != 0,
  105 + self.test_assert(self._execute(cmd, success=False) != 0,
110 106 'Check invalid input file when executed from command line')
111 107  
112 108 # Check cspull --help
... ...
test/test_csresmap.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -79,10 +79,6 @@ class Test(test):
79 79 ' algorithm="SUBDIVSQRT"'+ \
80 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 82 # Check if execution was successful
87 83 self.test_assert(self._execute(cmd) == 0,
88 84 'Check successful execution from command line')
... ... @@ -102,7 +98,7 @@ class Test(test):
102 98 ' logfile="csresmap_cmd2.log" debug=yes chatter=2'
103 99  
104 100 # Check if execution failed
105   - self.test_assert(self._execute(cmd) != 0,
  101 + self.test_assert(self._execute(cmd, success=False) != 0,
106 102 'Check invalid input file when executed from command line')
107 103  
108 104 # Check csresmap --help
... ...
test/test_csresspec.py
... ... @@ -81,10 +81,6 @@ class Test(test):
81 81 ' mask=no algorithm="SUB"' + \
82 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 84 # Check if execution was successful
89 85 self.test_assert(self._execute(cmd) == 0,
90 86 'Check successful execution from command line')
... ... @@ -102,8 +98,8 @@ class Test(test):
102 98 ' logfile="csresspec_cmd2.log" debug=yes chatter=2'
103 99  
104 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 104 # Check csresspec --help
109 105 self._check_help(csresspec)
... ...
test/test_csroot2caldb.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -19,7 +19,6 @@
19 19 #
20 20 # ==========================================================================
21 21 import os
22   -#import gammalib
23 22 import cscripts
24 23 from testing import test
25 24  
... ... @@ -82,10 +81,6 @@ class Test(test):
82 81 ' analysis=DESY zenith=20.0 azimuth=0.0'+ \
83 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 84 # Check if execution was successful
90 85 self.test_assert(self._execute(cmd) == 0,
91 86 'Check successful execution from command line')
... ...
test/test_cssens.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -79,10 +79,6 @@ class Test(test):
79 79 ' outfile="cssens_cmd1.dat"'+ \
80 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 82 # Check if execution was successful
87 83 self.test_assert(self._execute(cmd) == 0,
88 84 'Check successful execution from command line')
... ... @@ -99,7 +95,7 @@ class Test(test):
99 95 ' logfile="cssens_cmd2.log" debug=yes chatter=2'
100 96  
101 97 # Check if execution failed
102   - self.test_assert(self._execute(cmd) != 0,
  98 + self.test_assert(self._execute(cmd, success=False) != 0,
103 99 'Check invalid input file when executed from command line')
104 100  
105 101 # Check cssens --help
... ...
test/test_csspec.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -87,10 +87,6 @@ class Test(test):
87 87 ' outfile="csspec_cmd1.fits"'+ \
88 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 90 # Check if execution was successful
95 91 self.test_assert(self._execute(cmd) == 0,
96 92 'Check successful execution from command line')
... ... @@ -108,7 +104,7 @@ class Test(test):
108 104 ' logfile="csspec_cmd2.log" debug=yes chatter=1'
109 105  
110 106 # Check if execution failed
111   - self.test_assert(self._execute(cmd) != 0,
  107 + self.test_assert(self._execute(cmd, success=False) != 0,
112 108 'Check invalid input file when executed from command line')
113 109  
114 110 # Check csspec --help
... ...
test/test_cssrcdetect.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -78,10 +78,6 @@ class Test(test):
78 78 ' srcmodel="POINT" bkgmodel="NONE" threshold=10.0'+ \
79 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 81 # Check if execution was successful
86 82 self.test_assert(self._execute(cmd) == 0,
87 83 'Check successful execution from command line')
... ... @@ -97,7 +93,7 @@ class Test(test):
97 93 ' logfile="cssrcdetect_cmd2.log" debug=yes chatter=2'
98 94  
99 95 # Check if execution failed
100   - self.test_assert(self._execute(cmd) != 0,
  96 + self.test_assert(self._execute(cmd, success=False) != 0,
101 97 'Check invalid input file when executed from command line')
102 98  
103 99 # Check cssrcdetect --help
... ...
test/test_cstsdist.py
... ... @@ -85,10 +85,6 @@ class Test(test):
85 85 ' outfile="cstsdist_cmd1.dat"'+ \
86 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 88 # Check if execution was successful
93 89 self.test_assert(self._execute(cmd) == 0,
94 90 'Check successful execution from command line')
... ... @@ -105,7 +101,7 @@ class Test(test):
105 101 ' logfile="cstsdist_cmd2.log" chatter=2'
106 102  
107 103 # Check if execution failed
108   - self.test_assert(self._execute(cmd) != 0,
  104 + self.test_assert(self._execute(cmd, success=False) != 0,
109 105 'Check invalid input file when executed from command line')
110 106  
111 107 # Check cstsdist --help
... ...
test/test_cstsmapmerge.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -79,10 +79,6 @@ class Test(test):
79 79 ' outmap="cstsmapmerge_cmd1.fits"'+ \
80 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 82 # Check if execution was successful
87 83 self.test_assert(self._execute(cmd) == 0,
88 84 'Check successful execution from command line')
... ... @@ -96,7 +92,7 @@ class Test(test):
96 92 ' logfile="cstsmapmerge_cmd2.log" debug=yes chatter=2'
97 93  
98 94 # Check if execution failed
99   - self.test_assert(self._execute(cmd) != 0,
  95 + self.test_assert(self._execute(cmd, success=False) != 0,
100 96 'Check invalid input file when executed from command line')
101 97  
102 98 # Check cstsmapmerge --help
... ...
test/test_cstsmapsplit.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -87,10 +87,6 @@ class Test(test):
87 87 ' outfile="cstsmapsplit_cmd1.dat"'+ \
88 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 90 # Check if execution was successful
95 91 self.test_assert(self._execute(cmd) == 0,
96 92 'Check successful execution from command line')
... ... @@ -118,7 +114,7 @@ class Test(test):
118 114 ' logfile="cstsmapsplit_cmd2.log" debug=yes chatter=2'
119 115  
120 116 # Check if execution failed
121   - self.test_assert(self._execute(cmd) != 0,
  117 + self.test_assert(self._execute(cmd, success=False) != 0,
122 118 'Check invalid input file when executed from command line')
123 119  
124 120 # Check cstsmapsplit --help
... ...
test/test_csviscube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -70,10 +70,6 @@ class Test(test):
70 70 ' geolat=-24.6272 binsz=10.0 outfile=csviscube_cmd1.fits'+\
71 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 73 # Check if execution was successful
78 74 self.test_assert(self._execute(cmd) == 0,
79 75 'Check successful execution from command line')
... ...
test/test_csworkflow.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -78,10 +78,6 @@ class Test(test):
78 78 cmd = csworkflow+' inflow="'+self._workflow+'"'+ \
79 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 81 # Check if execution was successful
86 82 self.test_assert(self._execute(cmd) == 0,
87 83 'Check successful execution from command line')
... ...
test/test_ctbin.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,10 +77,6 @@ class Test(test):
77 77 ' xref=83.63 yref=22.01 proj="CAR"'+ \
78 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 80 # Check if execution was successful
85 81 self.test_value(self._execute(cmd), 0,
86 82 'Check successful execution from command line')
... ... @@ -98,7 +94,7 @@ class Test(test):
98 94 ' logfile="ctbin_cmd2.log" debug=yes chatter=1'
99 95  
100 96 # Check if execution failed
101   - self.test_assert(self._execute(cmd) != 0,
  97 + self.test_assert(self._execute(cmd, success=False) != 0,
102 98 'Check invalid input file when executed from command line')
103 99  
104 100 # Setup ctbin command with different ebounds than input
... ...
test/test_ctbkgcube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,10 +77,6 @@ class Test(test):
77 77 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
78 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 80 # Check if execution was successful
85 81 self.test_assert(self._execute(cmd) == 0,
86 82 'Check successful execution from command line')
... ... @@ -101,7 +97,7 @@ class Test(test):
101 97 ' logfile="ctbkgcube_cmd2.log" debug=yes chatter=1'
102 98  
103 99 # Check if execution failed
104   - self.test_assert(self._execute(cmd) != 0,
  100 + self.test_assert(self._execute(cmd, success=False) != 0,
105 101 'Check invalid input file when executed from command line')
106 102  
107 103 # Check ctbkgcube --help
... ...
test/test_ctbutterfly.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -72,10 +72,6 @@ class Test(test):
72 72 ' emin=0.1 emax=100.0'+ \
73 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 75 # Check if execution was successful
80 76 self.test_assert(self._execute(cmd) == 0,
81 77 'Check successful execution from command line')
... ... @@ -92,7 +88,7 @@ class Test(test):
92 88 ' logfile="ctbutterfly_cmd2.log" debug=yes chatter=1'
93 89  
94 90 # Check if execution failed
95   - self.test_assert(self._execute(cmd) != 0,
  91 + self.test_assert(self._execute(cmd, success=False) != 0,
96 92 'Check invalid input file when executed from command line')
97 93  
98 94 # Check ctbutterfly --help
... ...
test/test_ctcubemask.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -76,10 +76,6 @@ class Test(test):
76 76 ' emin=0.1 emax=100.0'+ \
77 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 79 # Check if execution was successful
84 80 self.test_assert(self._execute(cmd) == 0,
85 81 'Check successful execution from command line')
... ... @@ -96,7 +92,7 @@ class Test(test):
96 92 ' logfile="ctcubemask_cmd2.log" debug=yes chatter=2'
97 93  
98 94 # Check if execution failed
99   - self.test_assert(self._execute(cmd) != 0,
  95 + self.test_assert(self._execute(cmd, success=False) != 0,
100 96 'Check invalid input file when executed from command line')
101 97  
102 98 # Check ctcubemask --help
... ...
test/test_ctedispcube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -76,10 +76,6 @@ class Test(test):
76 76 ' migramax=2.0 migrabins=10'+ \
77 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 79 # Check if execution was successful
84 80 self.test_assert(self._execute(cmd) == 0,
85 81 'Check successful execution from command line')
... ... @@ -99,7 +95,7 @@ class Test(test):
99 95 ' logfile="ctedispcube_cmd2.log" debug=yes chatter=2'
100 96  
101 97 # Check if execution failed
102   - self.test_assert(self._execute(cmd) != 0,
  98 + self.test_assert(self._execute(cmd, success=False) != 0,
103 99 'Check invalid input file when executed from command line')
104 100  
105 101 # Check ctedispcube --help
... ...
test/test_cterror.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -71,10 +71,6 @@ class Test(test):
71 71 ' outmodel="cterror_cmd1.xml"'+ \
72 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 74 # Check if execution was successful
79 75 self.test_assert(self._execute(cmd) == 0,
80 76 'Check successful execution from command line')
... ... @@ -90,7 +86,7 @@ class Test(test):
90 86 ' logfile="cterror_cmd2.log" debug=yes chatter=1'
91 87  
92 88 # Check if execution failed
93   - self.test_assert(self._execute(cmd) != 0,
  89 + self.test_assert(self._execute(cmd, success=False) != 0,
94 90 'Check invalid input file when executed from command line')
95 91  
96 92 # Check cterror --help
... ...
test/test_ctexpcube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -75,10 +75,6 @@ class Test(test):
75 75 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
76 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 78 # Check if execution was successful
83 79 self.test_assert(self._execute(cmd) == 0,
84 80 'Check successful execution from command line')
... ... @@ -97,7 +93,7 @@ class Test(test):
97 93 ' logfile="ctexpcube_cmd2.log" debug=yes chatter=1'
98 94  
99 95 # Check if execution failed
100   - self.test_assert(self._execute(cmd) != 0,
  96 + self.test_assert(self._execute(cmd, success=False) != 0,
101 97 'Check invalid input file when executed from command line')
102 98  
103 99 # Check ctexpcube --help
... ...
test/test_ctlike.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -71,10 +71,6 @@ class Test(test):
71 71 ' outmodel="ctlike_cmd1.xml"'+ \
72 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 74 # Check if execution was successful
79 75 self.test_assert(self._execute(cmd) == 0,
80 76 'Check successful execution from command line')
... ... @@ -90,7 +86,7 @@ class Test(test):
90 86 ' logfile="ctlike_cmd2.log" debug=yes chatter=1'
91 87  
92 88 # Check if execution failed
93   - self.test_assert(self._execute(cmd) != 0,
  89 + self.test_assert(self._execute(cmd, success=False) != 0,
94 90 'Check invalid input file when executed from command line')
95 91  
96 92 # Check ctlike --help
... ...
test/test_ctmapcube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,10 +77,6 @@ class Test(test):
77 77 ' xref=83.63 yref=22.01 proj=CAR'+ \
78 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 80 # Check if execution was successful
85 81 self.test_assert(self._execute(cmd) == 0,
86 82 'Check successful execution from command line')
... ... @@ -97,7 +93,7 @@ class Test(test):
97 93 ' logfile="ctmapcube_cmd2.log" debug=yes '
98 94  
99 95 # Check if execution failed
100   - self.test_assert(self._execute(cmd) != 0,
  96 + self.test_assert(self._execute(cmd, success=False) != 0,
101 97 'Check invalid input file when executed from command line')
102 98  
103 99 # Check ctmapcube --help
... ...
test/test_ctmodel.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,10 +77,6 @@ class Test(test):
77 77 ' xref=83.63 yref=22.01'+ \
78 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 80 # Check if execution was successful
85 81 self.test_assert(self._execute(cmd) == 0,
86 82 'Check successful execution from command line')
... ... @@ -101,7 +97,7 @@ class Test(test):
101 97 ' logfile="ctmodel_cmd2.log" debug=yes chatter=1'
102 98  
103 99 # Check if execution failed
104   - self.test_assert(self._execute(cmd) != 0,
  100 + self.test_assert(self._execute(cmd, success=False) != 0,
105 101 'Check invalid input file when executed from command line')
106 102  
107 103 # Check ctmodel --help
... ...
test/test_ctobssim.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -80,10 +80,6 @@ class Test(test):
80 80 ' emin=0.1 emax=100.0'+ \
81 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 83 # Check if execution was successful
88 84 self.test_assert(self._execute(cmd) == 0,
89 85 'Check successful execution from command line')
... ... @@ -103,7 +99,7 @@ class Test(test):
103 99 ' logfile="ctobssim_cmd2.log" debug=yes chatter=1'
104 100  
105 101 # Check if execution failed
106   - self.test_assert(self._execute(cmd) != 0,
  102 + self.test_assert(self._execute(cmd, success=False) != 0,
107 103 'Check invalid input file when executed from command line')
108 104  
109 105 # Check ctobssim --help
... ...
test/test_ctphase.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -75,10 +75,6 @@ class Test(test):
75 75 ' inmodel="'+self._model_file+'" srcname="Crab"'+ \
76 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 78 # Check if execution was successful
83 79 self.test_assert(self._execute(cmd) == 0,
84 80 'Check successful execution from command line')
... ... @@ -93,7 +89,7 @@ class Test(test):
93 89 ' logfile="ctphase_cmd2.log" debug=yes chatter=1'
94 90  
95 91 # Check if execution failed
96   - self.test_assert(self._execute(cmd) != 0,
  92 + self.test_assert(self._execute(cmd, success=False) != 0,
97 93 'Check invalid input file when executed from command line')
98 94  
99 95 # Check ctphase --help
... ...
test/test_ctprob.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -92,7 +92,7 @@ class Test(test):
92 92 ' logfile="ctprob_cmd2.log" debug=yes chatter=1'
93 93  
94 94 # Check if execution failed
95   - self.test_assert(self._execute(cmd) != 0,
  95 + self.test_assert(self._execute(cmd, success=False) != 0,
96 96 'Check invalid input file when executed from command line')
97 97  
98 98 # Check ctprob --help
... ...
test/test_ctpsfcube.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -76,10 +76,6 @@ class Test(test):
76 76 ' amax=0.3 anumbins=10'+ \
77 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 79 # Check if execution was successful
84 80 self.test_assert(self._execute(cmd) == 0,
85 81 'Check successful execution from command line')
... ... @@ -99,7 +95,7 @@ class Test(test):
99 95 ' logfile="ctpsfcube_cmd2.log" debug=yes chatter=1'
100 96  
101 97 # Check if execution failed
102   - self.test_assert(self._execute(cmd) != 0,
  98 + self.test_assert(self._execute(cmd, success=False) != 0,
103 99 'Check invalid input file when executed from command line')
104 100  
105 101 # Check ctpsfcube --help
... ...
test/test_ctselect.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -77,10 +77,6 @@ class Test(test):
77 77 ' emin=0.2 emax=80.0'+ \
78 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 80 # Check if execution was successful
85 81 self.test_assert(self._execute(cmd) == 0,
86 82 'Check successful execution from command line')
... ... @@ -97,7 +93,7 @@ class Test(test):
97 93 ' logfile="ctselect_cmd2.log" debug=yes chatter=1'
98 94  
99 95 # Check if execution failed
100   - self.test_assert(self._execute(cmd) != 0,
  96 + self.test_assert(self._execute(cmd, success=False) != 0,
101 97 'Check invalid input file when executed from command line')
102 98  
103 99 # Check ctselect --help
... ...
test/test_ctskymap.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -73,10 +73,6 @@ class Test(test):
73 73 ' xref=83.63 yref=22.01 bkgsubtract="NONE"'+ \
74 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 76 # Check if execution was successful
81 77 self.test_assert(self._execute(cmd) == 0,
82 78 'Check successful execution from command line')
... ... @@ -93,7 +89,7 @@ class Test(test):
93 89 ' logfile="ctskymap_cmd2.log" debug=yes chatter=2'
94 90  
95 91 # Check if execution failed
96   - self.test_assert(self._execute(cmd) != 0,
  92 + self.test_assert(self._execute(cmd, success=False) != 0,
97 93 'Check invalid input file when executed from command line')
98 94  
99 95 # Check ctskymap --help
... ...
test/test_cttsmap.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -74,10 +74,6 @@ class Test(test):
74 74 ' coordsys="CEL" proj="CAR" xref=83.63 yref=22.01'+ \
75 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 77 # Check if execution was successful
82 78 self.test_assert(self._execute(cmd) == 0,
83 79 'Check successful execution from command line')
... ... @@ -95,7 +91,7 @@ class Test(test):
95 91 ' logfile="cttsmap_cmd2.log" debug=yes chatter=2'
96 92  
97 93 # Check if execution failed
98   - self.test_assert(self._execute(cmd) != 0,
  94 + self.test_assert(self._execute(cmd, success=False) != 0,
99 95 'Check invalid input file when executed from command line')
100 96  
101 97 # Setup cttsmap command
... ...
test/test_ctulimit.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 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 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -18,7 +18,6 @@
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19 #
20 20 # ==========================================================================
21   -#import gammalib
22 21 import ctools
23 22 from testing import test
24 23  
... ... @@ -70,10 +69,6 @@ class Test(test):
70 69 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
71 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 72 # Check if execution was successful
78 73 self.test_assert(self._execute(cmd) == 0,
79 74 'Check successful execution from command line')
... ... @@ -85,7 +80,7 @@ class Test(test):
85 80 ' logfile="ctulimit_cmd2.log" debug=yes chatter=2'
86 81  
87 82 # Check if execution failed
88   - self.test_assert(self._execute(cmd) != 0,
  83 + self.test_assert(self._execute(cmd, success=False) != 0,
89 84 'Check invalid input file when executed from command line')
90 85  
91 86 # Setup ctulimit command
... ... @@ -95,7 +90,7 @@ class Test(test):
95 90 ' logfile="ctulimit_cmd2.log" debug=yes chatter=2'
96 91  
97 92 # Check if execution failed
98   - self.test_assert(self._execute(cmd) != 0,
  93 + self.test_assert(self._execute(cmd, success=False) != 0,
99 94 'Check invalid source name when executed from command line')
100 95  
101 96 # Check ctulimit --help
... ...
test/testing.py.in
1 1 # ==========================================================================
2 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 6 # This program is free software: you can redistribute it and/or modify
7 7 # it under the terms of the GNU General Public License as published by
... ... @@ -55,6 +55,16 @@ class test(gammalib.GPythonTestSuite):
55 55 def _script(self, name):
56 56 """
57 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 69 # Set script name dependent on whether the software is installed or
60 70 # not. If the software is not installed the 'TEST_BUILDDIR' environment
... ... @@ -72,6 +82,16 @@ class test(gammalib.GPythonTestSuite):
72 82 def _tool(self, name):
73 83 """
74 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 96 # Set tool name dependent on whether the software is installed or
77 97 # not. If the software is not installed the 'TEST_BUILDDIR' environment
... ... @@ -85,16 +105,39 @@ class test(gammalib.GPythonTestSuite):
85 105 return tool
86 106  
87 107 # Execute command and catch any exception
88   - def _execute(self, cmd):
  108 + def _execute(self, cmd, success=True):
89 109 """
90 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 124 # Execute command, make sure we catch any exception
93 125 try:
94   - rc = os.system(cmd+' >/dev/null 2>&1')
  126 + rc = os.system(cmd+' > ctools_test_output.dmp 2>&1')
95 127 except:
96 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 141 # Return return code
99 142 return rc
100 143  
... ... @@ -105,7 +148,7 @@ class test(gammalib.GPythonTestSuite):
105 148  
106 149 Returns
107 150 -------
108   - obs : `~gammalib.gammalib.GObservations`
  151 + obs : `~gammalib.GObservations`
109 152 Observations container
110 153 """
111 154 # Load CTA event list
... ... @@ -138,7 +181,7 @@ class test(gammalib.GPythonTestSuite):
138 181  
139 182 Returns
140 183 -------
141   - obs : `~gammalib.gammalib.GObservations`
  184 + obs : `~gammalib.GObservations`
142 185 Observations container
143 186 """
144 187 # Load CTA event list
... ... @@ -168,6 +211,12 @@ class test(gammalib.GPythonTestSuite):
168 211 # Check
169 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 221 # Setup tool --help option
173 222 cmd = tool+' --help'
... ... @@ -178,7 +227,7 @@ class test(gammalib.GPythonTestSuite):
178 227 self.test_value(self._execute(cmd), 0,
179 228 'Check successful execution with --help option')
180 229 else:
181   - self.test_assert(self._execute(cmd) != 0,
  230 + self.test_assert(self._execute(cmd, success=False) != 0,
182 231 'Check execution failure with --help option')
183 232  
184 233 # Return
... ...