Commit 8d1e82353865ca5d347fc59b6fdb4e970c68f2fe
1 parent
0746e919
Update .gitignore file
Showing
2 changed files
with
46 additions
and
41 deletions
.gitignore
test/test_csiactcopy.py
| @@ -44,9 +44,9 @@ class Test(test): | @@ -44,9 +44,9 @@ class Test(test): | ||
| 44 | test.__init__(self) | 44 | test.__init__(self) |
| 45 | 45 | ||
| 46 | # Set data members | 46 | # Set data members |
| 47 | - self._remote = self._datadir + '/iactdata/master.json' | ||
| 48 | - self._runlist1 = self._datadir + '/iact_runlist_1.dat' | ||
| 49 | - self._runlist2 = self._datadir + '/iact_runlist_2.dat' | 47 | + self._remote = self._datadir + '/iactdata/master.json' |
| 48 | + self._runlist1 = self._datadir + '/iact_runlist_1.dat' | ||
| 49 | + self._runlist2 = self._datadir + '/iact_runlist_2.dat' | ||
| 50 | 50 | ||
| 51 | # Return | 51 | # Return |
| 52 | return | 52 | return |
| @@ -77,7 +77,7 @@ class Test(test): | @@ -77,7 +77,7 @@ class Test(test): | ||
| 77 | # Setup csiactcopy command | 77 | # Setup csiactcopy command |
| 78 | cmd = csiactcopy+' remote_master="'+self._remote+'"'+ \ | 78 | cmd = csiactcopy+' remote_master="'+self._remote+'"'+ \ |
| 79 | ' prodname="unit-test"'+ \ | 79 | ' prodname="unit-test"'+ \ |
| 80 | - ' outpath="iactdata_cmd1"'+ \ | 80 | + ' outpath="csiactcopy_cmd1"'+ \ |
| 81 | ' logfile="csiactcopy_cmd1.log" chatter=1' | 81 | ' logfile="csiactcopy_cmd1.log" chatter=1' |
| 82 | 82 | ||
| 83 | # Check if execution of wrong command fails | 83 | # Check if execution of wrong command fails |
| @@ -89,12 +89,12 @@ class Test(test): | @@ -89,12 +89,12 @@ class Test(test): | ||
| 89 | 'Check successful execution from command line') | 89 | 'Check successful execution from command line') |
| 90 | 90 | ||
| 91 | # Check copy | 91 | # Check copy |
| 92 | - self._check_copy('iactdata_cmd1') | 92 | + self._check_copy('csiactcopy_cmd1') |
| 93 | 93 | ||
| 94 | # Setup csiactcopy command | 94 | # Setup csiactcopy command |
| 95 | cmd = csiactcopy+' remote_master="master_that_does_not_exist"'+ \ | 95 | cmd = csiactcopy+' remote_master="master_that_does_not_exist"'+ \ |
| 96 | ' prodname="unit-test"'+ \ | 96 | ' prodname="unit-test"'+ \ |
| 97 | - ' outpath="iactdata_test"'+ \ | 97 | + ' outpath="csiactcopy_cmd2"'+ \ |
| 98 | ' logfile="csiactcopy_cmd2.log"' | 98 | ' logfile="csiactcopy_cmd2.log"' |
| 99 | 99 | ||
| 100 | # Check if execution failed | 100 | # Check if execution failed |
| @@ -113,9 +113,9 @@ class Test(test): | @@ -113,9 +113,9 @@ class Test(test): | ||
| 113 | iactcopy = cscripts.csiactcopy() | 113 | iactcopy = cscripts.csiactcopy() |
| 114 | iactcopy['remote_master'] = self._remote | 114 | iactcopy['remote_master'] = self._remote |
| 115 | iactcopy['prodname'] = 'unit-test' | 115 | iactcopy['prodname'] = 'unit-test' |
| 116 | - iactcopy['outpath'] = 'iactdata_py1' | 116 | + iactcopy['outpath'] = 'csiactcopy_py1' |
| 117 | iactcopy['logfile'] = 'csiactcopy_py1.log' | 117 | iactcopy['logfile'] = 'csiactcopy_py1.log' |
| 118 | - iactcopy['chatter'] = 4 | 118 | + iactcopy['chatter'] = 2 |
| 119 | 119 | ||
| 120 | # Run csiactcopy script and save run list | 120 | # Run csiactcopy script and save run list |
| 121 | iactcopy.logFileOpen() # Make sure we get a log file | 121 | iactcopy.logFileOpen() # Make sure we get a log file |
| @@ -123,32 +123,34 @@ class Test(test): | @@ -123,32 +123,34 @@ class Test(test): | ||
| 123 | iactcopy.save() | 123 | iactcopy.save() |
| 124 | 124 | ||
| 125 | # Check IACT data store | 125 | # Check IACT data store |
| 126 | - self._check_copy('iactdata_py1') | ||
| 127 | - self._check_n_obs('iactdata_py1', 9) | 126 | + self._check_copy('csiactcopy_py1') |
| 127 | + self._check_n_obs('csiactcopy_py1', 9) | ||
| 128 | 128 | ||
| 129 | - # Set-up csiactcopy | 129 | + # Set-up csiactcopy with clobber=True, should lead to skipping |
| 130 | + # of files | ||
| 130 | iactcopy = cscripts.csiactcopy() | 131 | iactcopy = cscripts.csiactcopy() |
| 131 | iactcopy['remote_master'] = self._remote | 132 | iactcopy['remote_master'] = self._remote |
| 132 | iactcopy['prodname'] = 'unit-test' | 133 | iactcopy['prodname'] = 'unit-test' |
| 133 | - iactcopy['outpath'] = 'iactdata_py1' | 134 | + iactcopy['outpath'] = 'csiactcopy_py1' |
| 134 | iactcopy['logfile'] = 'csiactcopy_py2.log' | 135 | iactcopy['logfile'] = 'csiactcopy_py2.log' |
| 135 | - iactcopy['chatter'] = 4 | 136 | + iactcopy['chatter'] = 3 |
| 136 | iactcopy['clobber'] = True | 137 | iactcopy['clobber'] = True |
| 137 | 138 | ||
| 138 | - # Run csiactcopy script and save run list | 139 | + # Execute csiactcopy script |
| 139 | iactcopy.logFileOpen() # Make sure we get a log file | 140 | iactcopy.logFileOpen() # Make sure we get a log file |
| 140 | - iactcopy.run() | ||
| 141 | - iactcopy.save() | 141 | + iactcopy.execute() |
| 142 | 142 | ||
| 143 | # Check copy | 143 | # Check copy |
| 144 | - self._check_copy('iactdata_py1') | ||
| 145 | - self._check_n_obs('iactdata_py1', 9) | 144 | + self._check_copy('csiactcopy_py1') |
| 145 | + self._check_n_obs('csiactcopy_py1', 9) | ||
| 146 | 146 | ||
| 147 | - # Set-up csiactcopy | 147 | + # Set-up csiactcopy with clobber=False, should also lead to skipping |
| 148 | + # of files, but for the reason that it's not allowed to overwrite | ||
| 149 | + # the file | ||
| 148 | iactcopy = cscripts.csiactcopy() | 150 | iactcopy = cscripts.csiactcopy() |
| 149 | iactcopy['remote_master'] = self._remote | 151 | iactcopy['remote_master'] = self._remote |
| 150 | iactcopy['prodname'] = 'unit-test' | 152 | iactcopy['prodname'] = 'unit-test' |
| 151 | - iactcopy['outpath'] = 'iactdata_py1' | 153 | + iactcopy['outpath'] = 'csiactcopy_py1' |
| 152 | iactcopy['logfile'] = 'csiactcopy_py3.log' | 154 | iactcopy['logfile'] = 'csiactcopy_py3.log' |
| 153 | iactcopy['chatter'] = 4 | 155 | iactcopy['chatter'] = 4 |
| 154 | iactcopy['clobber'] = False | 156 | iactcopy['clobber'] = False |
| @@ -159,21 +161,21 @@ class Test(test): | @@ -159,21 +161,21 @@ class Test(test): | ||
| 159 | iactcopy.save() | 161 | iactcopy.save() |
| 160 | 162 | ||
| 161 | # Check copy | 163 | # Check copy |
| 162 | - self._check_copy('iactdata_py1') | ||
| 163 | - self._check_n_obs('iactdata_py1', 9) | 164 | + self._check_copy('csiactcopy_py1') |
| 165 | + self._check_n_obs('csiactcopy_py1', 9) | ||
| 164 | 166 | ||
| 165 | # Remove the copied IACT data store before continuing | 167 | # Remove the copied IACT data store before continuing |
| 166 | - if os.path.isdir('iactdata_py2'): | ||
| 167 | - os.system('rm -r iactdata_py2') | 168 | + if os.path.isdir('csiactcopy_py2'): |
| 169 | + os.system('rm -r csiactcopy_py2') | ||
| 168 | 170 | ||
| 169 | - # Set-up csiactcopy | 171 | + # Set-up csiactcopy using a run list with 5 runs |
| 170 | iactcopy = cscripts.csiactcopy() | 172 | iactcopy = cscripts.csiactcopy() |
| 171 | iactcopy['runlist'] = self._runlist1 | 173 | iactcopy['runlist'] = self._runlist1 |
| 172 | iactcopy['remote_master'] = self._remote | 174 | iactcopy['remote_master'] = self._remote |
| 173 | iactcopy['prodname'] = 'unit-test' | 175 | iactcopy['prodname'] = 'unit-test' |
| 174 | - iactcopy['outpath'] = 'iactdata_py2' | 176 | + iactcopy['outpath'] = 'csiactcopy_py2' |
| 175 | iactcopy['logfile'] = 'csiactcopy_py4.log' | 177 | iactcopy['logfile'] = 'csiactcopy_py4.log' |
| 176 | - iactcopy['chatter'] = 3 | 178 | + iactcopy['chatter'] = 4 |
| 177 | 179 | ||
| 178 | # Run csiactcopy script and save run list | 180 | # Run csiactcopy script and save run list |
| 179 | iactcopy.logFileOpen() # Make sure we get a log file | 181 | iactcopy.logFileOpen() # Make sure we get a log file |
| @@ -181,17 +183,18 @@ class Test(test): | @@ -181,17 +183,18 @@ class Test(test): | ||
| 181 | iactcopy.save() | 183 | iactcopy.save() |
| 182 | 184 | ||
| 183 | # Check copy | 185 | # Check copy |
| 184 | - self._check_copy('iactdata_py2') | ||
| 185 | - self._check_n_obs('iactdata_py2', 5) | 186 | + self._check_copy('csiactcopy_py2') |
| 187 | + self._check_n_obs('csiactcopy_py2', 5) | ||
| 186 | 188 | ||
| 187 | - # Set-up csiactcopy | 189 | + # Set-up csiactcopy using another run list with 4 runs. Should have |
| 190 | + # 9 runs in total in the data store afterwards | ||
| 188 | iactcopy = cscripts.csiactcopy() | 191 | iactcopy = cscripts.csiactcopy() |
| 189 | iactcopy['runlist'] = self._runlist2 | 192 | iactcopy['runlist'] = self._runlist2 |
| 190 | iactcopy['remote_master'] = self._remote | 193 | iactcopy['remote_master'] = self._remote |
| 191 | iactcopy['prodname'] = 'unit-test' | 194 | iactcopy['prodname'] = 'unit-test' |
| 192 | - iactcopy['outpath'] = 'iactdata_py2' | 195 | + iactcopy['outpath'] = 'csiactcopy_py2' |
| 193 | iactcopy['logfile'] = 'csiactcopy_py5.log' | 196 | iactcopy['logfile'] = 'csiactcopy_py5.log' |
| 194 | - iactcopy['chatter'] = 3 | 197 | + iactcopy['chatter'] = 4 |
| 195 | 198 | ||
| 196 | # Run csiactcopy script and save run list | 199 | # Run csiactcopy script and save run list |
| 197 | iactcopy.logFileOpen() # Make sure we get a log file | 200 | iactcopy.logFileOpen() # Make sure we get a log file |
| @@ -199,17 +202,19 @@ class Test(test): | @@ -199,17 +202,19 @@ class Test(test): | ||
| 199 | iactcopy.save() | 202 | iactcopy.save() |
| 200 | 203 | ||
| 201 | # Check copy | 204 | # Check copy |
| 202 | - self._check_copy('iactdata_py2') | ||
| 203 | - self._check_n_obs('iactdata_py2', 9) | 205 | + self._check_copy('csiactcopy_py2') |
| 206 | + self._check_n_obs('csiactcopy_py2', 9) | ||
| 204 | 207 | ||
| 205 | - # Set-up csiactcopy | 208 | + # Set-up csiactcopy using the same run list with 4 runs again, should |
| 209 | + # lead to skipping of files, and we should still have 9 runs at the | ||
| 210 | + # end in the datastore. | ||
| 206 | iactcopy = cscripts.csiactcopy() | 211 | iactcopy = cscripts.csiactcopy() |
| 207 | iactcopy['runlist'] = self._runlist2 | 212 | iactcopy['runlist'] = self._runlist2 |
| 208 | iactcopy['remote_master'] = self._remote | 213 | iactcopy['remote_master'] = self._remote |
| 209 | iactcopy['prodname'] = 'unit-test' | 214 | iactcopy['prodname'] = 'unit-test' |
| 210 | - iactcopy['outpath'] = 'iactdata_py2' | 215 | + iactcopy['outpath'] = 'csiactcopy_py2' |
| 211 | iactcopy['logfile'] = 'csiactcopy_py6.log' | 216 | iactcopy['logfile'] = 'csiactcopy_py6.log' |
| 212 | - iactcopy['chatter'] = 3 | 217 | + iactcopy['chatter'] = 4 |
| 213 | iactcopy['clobber'] = True | 218 | iactcopy['clobber'] = True |
| 214 | 219 | ||
| 215 | # Run csiactcopy script and save run list | 220 | # Run csiactcopy script and save run list |
| @@ -218,8 +223,8 @@ class Test(test): | @@ -218,8 +223,8 @@ class Test(test): | ||
| 218 | iactcopy.save() | 223 | iactcopy.save() |
| 219 | 224 | ||
| 220 | # Check copy | 225 | # Check copy |
| 221 | - self._check_copy('iactdata_py2') | ||
| 222 | - self._check_n_obs('iactdata_py2',9) | 226 | + self._check_copy('csiactcopy_py2') |
| 227 | + self._check_n_obs('csiactcopy_py2',9) | ||
| 223 | 228 | ||
| 224 | # Return | 229 | # Return |
| 225 | return | 230 | return |
| @@ -266,7 +271,7 @@ class Test(test): | @@ -266,7 +271,7 @@ class Test(test): | ||
| 266 | pathname : str | 271 | pathname : str |
| 267 | Path to copied IACT data store | 272 | Path to copied IACT data store |
| 268 | n_expected : int | 273 | n_expected : int |
| 269 | - Expected number of observation in IACT data store | 274 | + Expected number of observations in IACT data store |
| 270 | """ | 275 | """ |
| 271 | # Set file name | 276 | # Set file name |
| 272 | obs_index_name = gammalib.GFilename(pathname+'/obs-index.fits[OBS_INDEX]') | 277 | obs_index_name = gammalib.GFilename(pathname+'/obs-index.fits[OBS_INDEX]') |