Commit 32c8a9ba6069e8ff73319ac6920fd7d1aa7c9b78
1 parent
bd42954f
Reduce code duplications
Showing
45 changed files
with
177 additions
and
242 deletions
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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,6 +76,9 @@ class Test(test): |
| 76 | 76 | self.test_assert(self._execute(cmd) == 0, |
| 77 | 77 | 'Check successful execution from command line') |
| 78 | 78 | |
| 79 | + # Check cscaldb --help | |
| 80 | + self._check_help(cscaldb) | |
| 81 | + | |
| 79 | 82 | # Return |
| 80 | 83 | return |
| 81 | 84 | ... | ... |
test/test_csebins.py
| ... | ... | @@ -66,14 +66,14 @@ class Test(test): |
| 66 | 66 | Test csebins on the command line. |
| 67 | 67 | """ |
| 68 | 68 | # Set script name |
| 69 | - cslightcrv = self._script('csebins') | |
| 69 | + csebins = self._script('csebins') | |
| 70 | 70 | |
| 71 | - # Setup cslightcrv command | |
| 72 | - cmd = cslightcrv+' inobs="NONE"'+ \ | |
| 73 | - ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ | |
| 74 | - ' emin=0.1 emax=100.0'+ \ | |
| 75 | - ' outfile="csebins_cmd1.fits"'+ \ | |
| 76 | - ' logfile="csebins_cmd1.log" chatter=1' | |
| 71 | + # Setup csebins command | |
| 72 | + cmd = csebins+' inobs="NONE"'+ \ | |
| 73 | + ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ | |
| 74 | + ' emin=0.1 emax=100.0'+ \ | |
| 75 | + ' outfile="csebins_cmd1.fits"'+ \ | |
| 76 | + ' logfile="csebins_cmd1.log" chatter=1' | |
| 77 | 77 | |
| 78 | 78 | # Check if execution of wrong command fails |
| 79 | 79 | self.test_assert(self._execute('command_that_does_not_exist') != 0, |
| ... | ... | @@ -86,17 +86,20 @@ class Test(test): |
| 86 | 86 | # Check energy boundaries |
| 87 | 87 | self._check_ebounds('csebins_cmd1.fits', 33) |
| 88 | 88 | |
| 89 | - # Setup cslightcrv command | |
| 90 | - cmd = cslightcrv+' inobs="NONE"'+ \ | |
| 91 | - ' caldb="Database_that_does_not_exist" irf="'+self._irf+'"'+ \ | |
| 92 | - ' emin=0.1 emax=100.0'+ \ | |
| 93 | - ' outfile="csebins_cmd2.fits"'+ \ | |
| 94 | - ' logfile="csebins_cmd2.log" chatter=1' | |
| 89 | + # Setup csebins command | |
| 90 | + cmd = csebins+' inobs="NONE"'+ \ | |
| 91 | + ' caldb="Database_that_does_not_exist" irf="'+self._irf+'"'+ \ | |
| 92 | + ' emin=0.1 emax=100.0'+ \ | |
| 93 | + ' outfile="csebins_cmd2.fits"'+ \ | |
| 94 | + ' logfile="csebins_cmd2.log" chatter=1' | |
| 95 | 95 | |
| 96 | 96 | # Check if execution failed |
| 97 | 97 | self.test_assert(self._execute(cmd) != 0, |
| 98 | 98 | 'Check invalid input file when executed from command line') |
| 99 | 99 | |
| 100 | + # Check csebins --help | |
| 101 | + self._check_help(csebins) | |
| 102 | + | |
| 100 | 103 | # Return |
| 101 | 104 | return |
| 102 | 105 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -100,6 +100,9 @@ class Test(test): |
| 100 | 100 | self.test_assert(self._execute(cmd) != 0, |
| 101 | 101 | 'Check invalid input file when executed from command line') |
| 102 | 102 | |
| 103 | + # Check csfindobs --help | |
| 104 | + self._check_help(csfindobs) | |
| 105 | + | |
| 103 | 106 | # Return |
| 104 | 107 | return |
| 105 | 108 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -101,6 +101,9 @@ class Test(test): |
| 101 | 101 | self.test_assert(self._execute(cmd) != 0, |
| 102 | 102 | 'Check invalid input file when executed from command line') |
| 103 | 103 | |
| 104 | + # Check csiactcopy --help | |
| 105 | + self._check_help(csiactcopy) | |
| 106 | + | |
| 104 | 107 | # Return |
| 105 | 108 | return |
| 106 | 109 | |
| ... | ... | @@ -289,4 +292,4 @@ class Test(test): |
| 289 | 292 | self.test_value(n_obs, n_expected, 'Check for number of observations') |
| 290 | 293 | |
| 291 | 294 | # Return |
| 292 | - return | |
| 293 | 295 | \ No newline at end of file |
| 296 | + return | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -91,6 +91,9 @@ class Test(test): |
| 91 | 91 | self.test_assert(self._execute(cmd) != 0, |
| 92 | 92 | 'Check invalid input file when executed from command line') |
| 93 | 93 | |
| 94 | + # Check csiactdata --help | |
| 95 | + self._check_help(csiactdata) | |
| 96 | + | |
| 94 | 97 | # Return |
| 95 | 98 | return |
| 96 | 99 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -121,6 +121,9 @@ class Test(test): |
| 121 | 121 | self.test_assert(self._execute(cmd) != 0, |
| 122 | 122 | 'Check invalid input prodname when executed from command line') |
| 123 | 123 | |
| 124 | + # Check csiactobs --help | |
| 125 | + self._check_help(csiactobs) | |
| 126 | + | |
| 124 | 127 | # Return |
| 125 | 128 | return |
| 126 | 129 | ... | ... |
test/test_cslightcrv.py
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -97,6 +97,9 @@ class Test(test): |
| 97 | 97 | self.test_assert(self._execute(cmd) != 0, |
| 98 | 98 | 'Check invalid input file when executed from command line') |
| 99 | 99 | |
| 100 | + # Check csmodelinfo --help | |
| 101 | + self._check_help(csmodelinfo) | |
| 102 | + | |
| 100 | 103 | # Return |
| 101 | 104 | return |
| 102 | 105 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -99,6 +99,9 @@ class Test(test): |
| 99 | 99 | self.test_assert(self._execute(cmd) != 0, |
| 100 | 100 | 'Check invalid input file when executed from command line') |
| 101 | 101 | |
| 102 | + # Check csmodelmerge --help | |
| 103 | + self._check_help(csmodelmerge) | |
| 104 | + | |
| 102 | 105 | # Return |
| 103 | 106 | return |
| 104 | 107 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -96,6 +96,9 @@ class Test(test): |
| 96 | 96 | self.test_assert(self._execute(cmd) != 0, |
| 97 | 97 | 'Check invalid input file when executed from command line') |
| 98 | 98 | |
| 99 | + # Check csmodelselect --help | |
| 100 | + self._check_help(csmodelselect) | |
| 101 | + | |
| 99 | 102 | # Return |
| 100 | 103 | return |
| 101 | 104 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -101,6 +101,9 @@ class Test(test): |
| 101 | 101 | self.test_assert(self._execute(cmd) != 0, |
| 102 | 102 | 'Check invalid input file when executed from command line') |
| 103 | 103 | |
| 104 | + # Check csobs2caldb --help | |
| 105 | + self._check_help(csobs2caldb) | |
| 106 | + | |
| 104 | 107 | # Return |
| 105 | 108 | return |
| 106 | 109 | ... | ... |
test/test_csobsdef.py
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -98,6 +98,9 @@ class Test(test): |
| 98 | 98 | self.test_assert(self._execute(cmd) != 0, |
| 99 | 99 | 'Check invalid input file when executed from command line') |
| 100 | 100 | |
| 101 | + # Check csobsinfo --help | |
| 102 | + self._check_help(csobsinfo) | |
| 103 | + | |
| 101 | 104 | # Return |
| 102 | 105 | return |
| 103 | 106 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -98,6 +98,9 @@ class Test(test): |
| 98 | 98 | self.test_assert(self._execute(cmd) != 0, |
| 99 | 99 | 'Check invalid input file when executed from command line') |
| 100 | 100 | |
| 101 | + # Check csobsselect --help | |
| 102 | + self._check_help(csobsselect) | |
| 103 | + | |
| 101 | 104 | # Return |
| 102 | 105 | return |
| 103 | 106 | ... | ... |
test/test_csphasecrv.py
test/test_cspull.py
test/test_csresmap.py
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -90,6 +90,9 @@ class Test(test): |
| 90 | 90 | self.test_assert(self._execute(cmd) == 0, |
| 91 | 91 | 'Check successful execution from command line') |
| 92 | 92 | |
| 93 | + # Check csroot2caldb --help | |
| 94 | + self._check_help(csroot2caldb) | |
| 95 | + | |
| 93 | 96 | # Return |
| 94 | 97 | return |
| 95 | 98 | ... | ... |
test/test_cssens.py
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -108,6 +108,9 @@ class Test(test): |
| 108 | 108 | self.test_assert(self._execute(cmd) != 0, |
| 109 | 109 | 'Check invalid input file when executed from command line') |
| 110 | 110 | |
| 111 | + # Check csspec --help | |
| 112 | + self._check_help(csspec) | |
| 113 | + | |
| 111 | 114 | # Return |
| 112 | 115 | return |
| 113 | 116 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -101,6 +101,9 @@ class Test(test): |
| 101 | 101 | self.test_assert(self._execute(cmd) != 0, |
| 102 | 102 | 'Check invalid input file when executed from command line') |
| 103 | 103 | |
| 104 | + # Check cssrcdetect --help | |
| 105 | + self._check_help(cssrcdetect) | |
| 106 | + | |
| 104 | 107 | # Return |
| 105 | 108 | return |
| 106 | 109 | ... | ... |
test/test_cstsdist.py
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -98,7 +98,10 @@ class Test(test): |
| 98 | 98 | # Check if execution failed |
| 99 | 99 | self.test_assert(self._execute(cmd) != 0, |
| 100 | 100 | 'Check invalid input file when executed from command line') |
| 101 | - | |
| 101 | + | |
| 102 | + # Check cstsmapmerge --help | |
| 103 | + self._check_help(cstsmapmerge) | |
| 104 | + | |
| 102 | 105 | # Return |
| 103 | 106 | return |
| 104 | 107 | ... | ... |
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 Michael Mayer | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -121,6 +121,9 @@ class Test(test): |
| 121 | 121 | self.test_assert(self._execute(cmd) != 0, |
| 122 | 122 | 'Check invalid input file when executed from command line') |
| 123 | 123 | |
| 124 | + # Check cstsmapsplit --help | |
| 125 | + self._check_help(cstsmapsplit) | |
| 126 | + | |
| 124 | 127 | # Return |
| 125 | 128 | return |
| 126 | 129 | ... | ... |
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 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2016-2017 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,6 +78,9 @@ class Test(test): |
| 78 | 78 | self.test_assert(self._execute(cmd) == 0, |
| 79 | 79 | 'Check successful execution from command line') |
| 80 | 80 | |
| 81 | + # Check csviscube --help | |
| 82 | + self._check_help(csviscube) | |
| 83 | + | |
| 81 | 84 | # Return |
| 82 | 85 | return |
| 83 | 86 | ... | ... |
test/test_csworkflow.py
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -117,17 +117,8 @@ class Test(test): |
| 117 | 117 | evt = gammalib.GCTAEventCube('cntmap_cmd3.fits') |
| 118 | 118 | self._check_cube(evt, 890) |
| 119 | 119 | |
| 120 | - # Setup ctbin --help option | |
| 121 | - cmd = ctbin+' --help' | |
| 122 | - | |
| 123 | - # Check if execution was successful in case that the CTOOLS | |
| 124 | - # environment variable was set or failed otherwise | |
| 125 | - if 'CTOOLS' in os.environ: | |
| 126 | - self.test_value(self._execute(cmd), 0, | |
| 127 | - 'Check successful execution with --help option') | |
| 128 | - else: | |
| 129 | - self.test_assert(self._execute(cmd) != 0, | |
| 130 | - 'Check execution failure with --help option') | |
| 120 | + # Check ctbin --help | |
| 121 | + self._check_help(ctbin) | |
| 131 | 122 | |
| 132 | 123 | # Return |
| 133 | 124 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -104,17 +104,8 @@ class Test(test): |
| 104 | 104 | self.test_assert(self._execute(cmd) != 0, |
| 105 | 105 | 'Check invalid input file when executed from command line') |
| 106 | 106 | |
| 107 | - # Setup ctbkgcube --help option | |
| 108 | - cmd = ctbkgcube+' --help' | |
| 109 | - | |
| 110 | - # Check if execution was successful in case that the CTOOLS | |
| 111 | - # environment variable was set or failed otherwise | |
| 112 | - if 'CTOOLS' in os.environ: | |
| 113 | - self.test_value(self._execute(cmd), 0, | |
| 114 | - 'Check successful execution with --help option') | |
| 115 | - else: | |
| 116 | - self.test_assert(self._execute(cmd) != 0, | |
| 117 | - 'Check execution failure with --help option') | |
| 107 | + # Check ctbkgcube --help | |
| 108 | + self._check_help(ctbkgcube) | |
| 118 | 109 | |
| 119 | 110 | # Return |
| 120 | 111 | return | ... | ... |
test/test_ctbutterfly.py
| ... | ... | @@ -96,17 +96,8 @@ class Test(test): |
| 96 | 96 | self.test_assert(self._execute(cmd) != 0, |
| 97 | 97 | 'Check invalid input file when executed from command line') |
| 98 | 98 | |
| 99 | - # Setup ctbutterfly --help option | |
| 100 | - cmd = ctbutterfly+' --help' | |
| 101 | - | |
| 102 | - # Check if execution was successful in case that the CTOOLS | |
| 103 | - # environment variable was set or failed otherwise | |
| 104 | - if 'CTOOLS' in os.environ: | |
| 105 | - self.test_value(self._execute(cmd), 0, | |
| 106 | - 'Check successful execution with --help option') | |
| 107 | - else: | |
| 108 | - self.test_assert(self._execute(cmd) != 0, | |
| 109 | - 'Check execution failure with --help option') | |
| 99 | + # Check ctbutterfly --help | |
| 100 | + self._check_help(ctbutterfly) | |
| 110 | 101 | |
| 111 | 102 | # Return |
| 112 | 103 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -99,17 +99,8 @@ class Test(test): |
| 99 | 99 | self.test_assert(self._execute(cmd) != 0, |
| 100 | 100 | 'Check invalid input file when executed from command line') |
| 101 | 101 | |
| 102 | - # Setup ctcubemask --help option | |
| 103 | - cmd = ctcubemask+' --help' | |
| 104 | - | |
| 105 | - # Check if execution was successful in case that the CTOOLS | |
| 106 | - # environment variable was set or failed otherwise | |
| 107 | - if 'CTOOLS' in os.environ: | |
| 108 | - self.test_value(self._execute(cmd), 0, | |
| 109 | - 'Check successful execution with --help option') | |
| 110 | - else: | |
| 111 | - self.test_assert(self._execute(cmd) != 0, | |
| 112 | - 'Check execution failure with --help option') | |
| 102 | + # Check ctcubemask --help | |
| 103 | + self._check_help(ctcubemask) | |
| 113 | 104 | |
| 114 | 105 | # Return |
| 115 | 106 | return | ... | ... |
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 Maria Haupt | |
| 5 | +# Copyright (C) 2016-2017 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 |
| ... | ... | @@ -102,17 +102,8 @@ class Test(test): |
| 102 | 102 | self.test_assert(self._execute(cmd) != 0, |
| 103 | 103 | 'Check invalid input file when executed from command line') |
| 104 | 104 | |
| 105 | - # Setup ctedispcube --help option | |
| 106 | - cmd = ctedispcube+' --help' | |
| 107 | - | |
| 108 | - # Check if execution was successful in case that the CTOOLS | |
| 109 | - # environment variable was set or failed otherwise | |
| 110 | - if 'CTOOLS' in os.environ: | |
| 111 | - self.test_value(self._execute(cmd), 0, | |
| 112 | - 'Check successful execution with --help option') | |
| 113 | - else: | |
| 114 | - self.test_assert(self._execute(cmd) != 0, | |
| 115 | - 'Check execution failure with --help option') | |
| 105 | + # Check ctedispcube --help | |
| 106 | + self._check_help(ctedispcube) | |
| 116 | 107 | |
| 117 | 108 | # Return |
| 118 | 109 | return | ... | ... |
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-2016 Florent Forest | |
| 5 | +# Copyright (C) 2015-2017 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 |
| ... | ... | @@ -94,17 +94,8 @@ class Test(test): |
| 94 | 94 | self.test_assert(self._execute(cmd) != 0, |
| 95 | 95 | 'Check invalid input file when executed from command line') |
| 96 | 96 | |
| 97 | - # Setup cterror --help option | |
| 98 | - cmd = cterror+' --help' | |
| 99 | - | |
| 100 | - # Check if execution was successful in case that the CTOOLS | |
| 101 | - # environment variable was set or failed otherwise | |
| 102 | - if 'CTOOLS' in os.environ: | |
| 103 | - self.test_value(self._execute(cmd), 0, | |
| 104 | - 'Check successful execution with --help option') | |
| 105 | - else: | |
| 106 | - self.test_assert(self._execute(cmd) != 0, | |
| 107 | - 'Check execution failure with --help option') | |
| 97 | + # Check cterror --help | |
| 98 | + self._check_help(cterror) | |
| 108 | 99 | |
| 109 | 100 | # Return |
| 110 | 101 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -100,17 +100,8 @@ class Test(test): |
| 100 | 100 | self.test_assert(self._execute(cmd) != 0, |
| 101 | 101 | 'Check invalid input file when executed from command line') |
| 102 | 102 | |
| 103 | - # Setup ctexpcube --help option | |
| 104 | - cmd = ctexpcube+' --help' | |
| 105 | - | |
| 106 | - # Check if execution was successful in case that the CTOOLS | |
| 107 | - # environment variable was set or failed otherwise | |
| 108 | - if 'CTOOLS' in os.environ: | |
| 109 | - self.test_value(self._execute(cmd), 0, | |
| 110 | - 'Check successful execution with --help option') | |
| 111 | - else: | |
| 112 | - self.test_assert(self._execute(cmd) != 0, | |
| 113 | - 'Check execution failure with --help option') | |
| 103 | + # Check ctexpcube --help | |
| 104 | + self._check_help(ctexpcube) | |
| 114 | 105 | |
| 115 | 106 | # Return |
| 116 | 107 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -94,17 +94,8 @@ class Test(test): |
| 94 | 94 | self.test_assert(self._execute(cmd) != 0, |
| 95 | 95 | 'Check invalid input file when executed from command line') |
| 96 | 96 | |
| 97 | - # Setup ctlike --help option | |
| 98 | - cmd = ctlike+' --help' | |
| 99 | - | |
| 100 | - # Check if execution was successful in case that the CTOOLS | |
| 101 | - # environment variable was set or failed otherwise | |
| 102 | - if 'CTOOLS' in os.environ: | |
| 103 | - self.test_value(self._execute(cmd), 0, | |
| 104 | - 'Check successful execution with --help option') | |
| 105 | - else: | |
| 106 | - self.test_assert(self._execute(cmd) != 0, | |
| 107 | - 'Check execution failure with --help option') | |
| 97 | + # Check ctlike --help | |
| 98 | + self._check_help(ctlike) | |
| 108 | 99 | |
| 109 | 100 | # Return |
| 110 | 101 | return | ... | ... |
test/test_ctmapcube.py
| ... | ... | @@ -100,17 +100,8 @@ class Test(test): |
| 100 | 100 | self.test_assert(self._execute(cmd) != 0, |
| 101 | 101 | 'Check invalid input file when executed from command line') |
| 102 | 102 | |
| 103 | - # Setup ctmapcube --help option | |
| 104 | - cmd = ctmapcube+' --help' | |
| 105 | - | |
| 106 | - # Check if execution was successful in case that the CTOOLS | |
| 107 | - # environment variable was set or failed otherwise | |
| 108 | - if 'CTOOLS' in os.environ: | |
| 109 | - self.test_value(self._execute(cmd), 0, | |
| 110 | - 'Check successful execution with --help option') | |
| 111 | - else: | |
| 112 | - self.test_assert(self._execute(cmd) != 0, | |
| 113 | - 'Check execution failure with --help option') | |
| 103 | + # Check ctmapcube --help | |
| 104 | + self._check_help(ctmapcube) | |
| 114 | 105 | |
| 115 | 106 | # Return |
| 116 | 107 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -104,17 +104,8 @@ class Test(test): |
| 104 | 104 | self.test_assert(self._execute(cmd) != 0, |
| 105 | 105 | 'Check invalid input file when executed from command line') |
| 106 | 106 | |
| 107 | - # Setup ctmodel --help option | |
| 108 | - cmd = ctmodel+' --help' | |
| 109 | - | |
| 110 | - # Check if execution was successful in case that the CTOOLS | |
| 111 | - # environment variable was set or failed otherwise | |
| 112 | - if 'CTOOLS' in os.environ: | |
| 113 | - self.test_value(self._execute(cmd), 0, | |
| 114 | - 'Check successful execution with --help option') | |
| 115 | - else: | |
| 116 | - self.test_assert(self._execute(cmd) != 0, | |
| 117 | - 'Check execution failure with --help option') | |
| 107 | + # Check ctmodel --help | |
| 108 | + self._check_help(ctmodel) | |
| 118 | 109 | |
| 119 | 110 | # Return |
| 120 | 111 | return | ... | ... |
test/test_ctobssim.py
| ... | ... | @@ -106,17 +106,8 @@ class Test(test): |
| 106 | 106 | self.test_assert(self._execute(cmd) != 0, |
| 107 | 107 | 'Check invalid input file when executed from command line') |
| 108 | 108 | |
| 109 | - # Setup ctobssim --help option | |
| 110 | - cmd = ctobssim+' --help' | |
| 111 | - | |
| 112 | - # Check if execution was successful in case that the CTOOLS | |
| 113 | - # environment variable was set or failed otherwise | |
| 114 | - if 'CTOOLS' in os.environ: | |
| 115 | - self.test_value(self._execute(cmd), 0, | |
| 116 | - 'Check successful execution with --help option') | |
| 117 | - else: | |
| 118 | - self.test_assert(self._execute(cmd) != 0, | |
| 119 | - 'Check execution failure with --help option') | |
| 109 | + # Check ctobssim --help | |
| 110 | + self._check_help(ctobssim) | |
| 120 | 111 | |
| 121 | 112 | # Return |
| 122 | 113 | return | ... | ... |
test/test_ctphase.py
| ... | ... | @@ -96,17 +96,8 @@ class Test(test): |
| 96 | 96 | self.test_assert(self._execute(cmd) != 0, |
| 97 | 97 | 'Check invalid input file when executed from command line') |
| 98 | 98 | |
| 99 | - # Setup ctphase --help option | |
| 100 | - cmd = ctphase+' --help' | |
| 101 | - | |
| 102 | - # Check if execution was successful in case that the CTOOLS | |
| 103 | - # environment variable was set or failed otherwise | |
| 104 | - if 'CTOOLS' in os.environ: | |
| 105 | - self.test_value(self._execute(cmd), 0, | |
| 106 | - 'Check successful execution with --help option') | |
| 107 | - else: | |
| 108 | - self.test_assert(self._execute(cmd) != 0, | |
| 109 | - 'Check execution failure with --help option') | |
| 99 | + # Check ctphase --help | |
| 100 | + self._check_help(ctphase) | |
| 110 | 101 | |
| 111 | 102 | # Return |
| 112 | 103 | return | ... | ... |
test/test_ctprob.py
| ... | ... | @@ -95,17 +95,8 @@ class Test(test): |
| 95 | 95 | self.test_assert(self._execute(cmd) != 0, |
| 96 | 96 | 'Check invalid input file when executed from command line') |
| 97 | 97 | |
| 98 | - # Setup ctprob --help option | |
| 99 | - cmd = ctprob+' --help' | |
| 100 | - | |
| 101 | - # Check if execution was successful in case that the CTOOLS | |
| 102 | - # environment variable was set or failed otherwise | |
| 103 | - if 'CTOOLS' in os.environ: | |
| 104 | - self.test_value(self._execute(cmd), 0, | |
| 105 | - 'Check successful execution with --help option') | |
| 106 | - else: | |
| 107 | - self.test_assert(self._execute(cmd) != 0, | |
| 108 | - 'Check execution failure with --help option') | |
| 98 | + # Check ctprob --help | |
| 99 | + self._check_help(ctprob) | |
| 109 | 100 | |
| 110 | 101 | # Return |
| 111 | 102 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -102,17 +102,8 @@ class Test(test): |
| 102 | 102 | self.test_assert(self._execute(cmd) != 0, |
| 103 | 103 | 'Check invalid input file when executed from command line') |
| 104 | 104 | |
| 105 | - # Setup ctpsfcube --help option | |
| 106 | - cmd = ctpsfcube+' --help' | |
| 107 | - | |
| 108 | - # Check if execution was successful in case that the CTOOLS | |
| 109 | - # environment variable was set or failed otherwise | |
| 110 | - if 'CTOOLS' in os.environ: | |
| 111 | - self.test_value(self._execute(cmd), 0, | |
| 112 | - 'Check successful execution with --help option') | |
| 113 | - else: | |
| 114 | - self.test_assert(self._execute(cmd) != 0, | |
| 115 | - 'Check execution failure with --help option') | |
| 105 | + # Check ctpsfcube --help | |
| 106 | + self._check_help(ctpsfcube) | |
| 116 | 107 | |
| 117 | 108 | # Return |
| 118 | 109 | return | ... | ... |
test/test_ctselect.py
| ... | ... | @@ -100,17 +100,8 @@ class Test(test): |
| 100 | 100 | self.test_assert(self._execute(cmd) != 0, |
| 101 | 101 | 'Check invalid input file when executed from command line') |
| 102 | 102 | |
| 103 | - # Setup ctselect --help option | |
| 104 | - cmd = ctselect+' --help' | |
| 105 | - | |
| 106 | - # Check if execution was successful in case that the CTOOLS | |
| 107 | - # environment variable was set or failed otherwise | |
| 108 | - if 'CTOOLS' in os.environ: | |
| 109 | - self.test_value(self._execute(cmd), 0, | |
| 110 | - 'Check successful execution with --help option') | |
| 111 | - else: | |
| 112 | - self.test_assert(self._execute(cmd) != 0, | |
| 113 | - 'Check execution failure with --help option') | |
| 103 | + # Check ctselect --help | |
| 104 | + self._check_help(ctselect) | |
| 114 | 105 | |
| 115 | 106 | # Return |
| 116 | 107 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -96,17 +96,8 @@ class Test(test): |
| 96 | 96 | self.test_assert(self._execute(cmd) != 0, |
| 97 | 97 | 'Check invalid input file when executed from command line') |
| 98 | 98 | |
| 99 | - # Setup ctskymap --help option | |
| 100 | - cmd = ctskymap+' --help' | |
| 101 | - | |
| 102 | - # Check if execution was successful in case that the CTOOLS | |
| 103 | - # environment variable was set or failed otherwise | |
| 104 | - if 'CTOOLS' in os.environ: | |
| 105 | - self.test_value(self._execute(cmd), 0, | |
| 106 | - 'Check successful execution with --help option') | |
| 107 | - else: | |
| 108 | - self.test_assert(self._execute(cmd) != 0, | |
| 109 | - 'Check execution failure with --help option') | |
| 99 | + # Check ctskymap --help | |
| 100 | + self._check_help(ctskymap) | |
| 110 | 101 | |
| 111 | 102 | # Return |
| 112 | 103 | return | ... | ... |
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-2016 Juergen Knoedlseder | |
| 5 | +# Copyright (C) 2014-2017 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 |
| ... | ... | @@ -115,17 +115,8 @@ class Test(test): |
| 115 | 115 | # Check result file |
| 116 | 116 | self._check_result_file('cttsmap_cmd3.fits') |
| 117 | 117 | |
| 118 | - # Setup cttsmap --help option | |
| 119 | - cmd = cttsmap+' --help' | |
| 120 | - | |
| 121 | - # Check if execution was successful in case that the CTOOLS | |
| 122 | - # environment variable was set or failed otherwise | |
| 123 | - if 'CTOOLS' in os.environ: | |
| 124 | - self.test_value(self._execute(cmd), 0, | |
| 125 | - 'Check successful execution with --help option') | |
| 126 | - else: | |
| 127 | - self.test_assert(self._execute(cmd) != 0, | |
| 128 | - 'Check execution failure with --help option') | |
| 118 | + # Check cttsmap --help | |
| 119 | + self._check_help(cttsmap) | |
| 129 | 120 | |
| 130 | 121 | # Return |
| 131 | 122 | return | ... | ... |
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-2016 Michael Mayer | |
| 5 | +# Copyright (C) 2015-2017 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 |
| ... | ... | @@ -92,17 +92,8 @@ class Test(test): |
| 92 | 92 | self.test_assert(self._execute(cmd) != 0, |
| 93 | 93 | 'Check invalid input file when executed from command line') |
| 94 | 94 | |
| 95 | - # Setup ctulimit --help option | |
| 96 | - cmd = ctulimit+' --help' | |
| 97 | - | |
| 98 | - # Check if execution was successful in case that the CTOOLS | |
| 99 | - # environment variable was set or failed otherwise | |
| 100 | - if 'CTOOLS' in os.environ: | |
| 101 | - self.test_value(self._execute(cmd), 0, | |
| 102 | - 'Check successful execution with --help option') | |
| 103 | - else: | |
| 104 | - self.test_assert(self._execute(cmd) != 0, | |
| 105 | - 'Check execution failure with --help option') | |
| 95 | + # Check ctulimit --help | |
| 96 | + self._check_help(ctulimit) | |
| 106 | 97 | |
| 107 | 98 | # Return |
| 108 | 99 | return | ... | ... |
test/testing.py.in
| ... | ... | @@ -164,3 +164,22 @@ class test(gammalib.GPythonTestSuite): |
| 164 | 164 | |
| 165 | 165 | # Return observation container |
| 166 | 166 | return obs |
| 167 | + | |
| 168 | + # Check | |
| 169 | + def _check_help(self, tool): | |
| 170 | + """ | |
| 171 | + """ | |
| 172 | + # Setup tool --help option | |
| 173 | + cmd = tool+' --help' | |
| 174 | + | |
| 175 | + # Check if execution was successful in case that the CTOOLS | |
| 176 | + # environment variable was set or failed otherwise | |
| 177 | + if 'CTOOLS' in os.environ: | |
| 178 | + self.test_value(self._execute(cmd), 0, | |
| 179 | + 'Check successful execution with --help option') | |
| 180 | + else: | |
| 181 | + self.test_assert(self._execute(cmd) != 0, | |
| 182 | + 'Check execution failure with --help option') | |
| 183 | + | |
| 184 | + # Return | |
| 185 | + return | ... | ... |