@@ -185,7 +185,7 @@ def test_scenario2a(self):
185185 pass
186186 self .table1 .write (self .fnames [num_scenario ], path = 'data' )
187187
188- f = h5py .File (self .fnames [num_scenario ])
188+ f = h5py .File (self .fnames [num_scenario ], 'r' )
189189 k = list (f .attrs .keys ())
190190 f .close ()
191191
@@ -206,15 +206,15 @@ def test_scenario2b(self):
206206
207207 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
208208
209- f = h5py .File (self .fnames [num_scenario ])
209+ f = h5py .File (self .fnames [num_scenario ], 'a' )
210210 for attr in self .hard_coded_log_attrs :
211211 f .attrs [attr ] = getattr (log_entry , attr )
212212 f .close ()
213213
214214 assert log_entry .safe_for_cache is False
215215 assert "``particle_mass``" in log_entry ._cache_safety_message
216216
217- f = h5py .File (self .fnames [num_scenario ])
217+ f = h5py .File (self .fnames [num_scenario ], 'a' )
218218 f .attrs ['Lbox' ] = 100.
219219 f .attrs ['particle_mass' ] = 1.e8
220220 f .close ()
@@ -233,7 +233,7 @@ def test_scenario2c(self):
233233
234234 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
235235
236- f = h5py .File (self .fnames [num_scenario ])
236+ f = h5py .File (self .fnames [num_scenario ], 'a' )
237237 for attr in self .hard_coded_log_attrs :
238238 if attr != 'redshift' :
239239 f .attrs [attr ] = getattr (log_entry , attr )
@@ -246,13 +246,13 @@ def test_scenario2c(self):
246246 assert log_entry .safe_for_cache is False
247247 assert "does not match" in log_entry ._cache_safety_message
248248
249- f = h5py .File (self .fnames [num_scenario ])
249+ f = h5py .File (self .fnames [num_scenario ], 'a' )
250250 f .attrs ['redshift' ] = 1.3390001
251251 f .close ()
252252 assert log_entry .safe_for_cache is False
253253 assert "does not match" not in log_entry ._cache_safety_message
254254
255- f = h5py .File (self .fnames [num_scenario ])
255+ f = h5py .File (self .fnames [num_scenario ], 'a' )
256256 f .attrs ['redshift' ] = '1.3390001'
257257 f .close ()
258258 assert log_entry .safe_for_cache is False
@@ -270,7 +270,7 @@ def test_scenario3(self):
270270
271271 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
272272
273- f = h5py .File (self .fnames [num_scenario ])
273+ f = h5py .File (self .fnames [num_scenario ], 'a' )
274274 for attr in self .hard_coded_log_attrs :
275275 f .attrs [attr ] = getattr (log_entry , attr )
276276 f .attrs ['Lbox' ] = 100.
@@ -296,7 +296,7 @@ def test_scenario3b(self):
296296
297297 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
298298
299- f = h5py .File (self .fnames [num_scenario ])
299+ f = h5py .File (self .fnames [num_scenario ], 'a' )
300300 for attr in self .hard_coded_log_attrs :
301301 f .attrs [attr ] = getattr (log_entry , attr )
302302 f .attrs ['Lbox' ] = 100.
@@ -324,7 +324,7 @@ def test_scenario3c(self):
324324 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
325325
326326 self .table3 .write (self .fnames [num_scenario ], path = 'data' )
327- f = h5py .File (self .fnames [num_scenario ])
327+ f = h5py .File (self .fnames [num_scenario ], 'a' )
328328 for attr in self .hard_coded_log_attrs :
329329 f .attrs [attr ] = getattr (log_entry , attr )
330330 f .attrs ['Lbox' ] = 100.
@@ -338,7 +338,7 @@ def test_scenario3c(self):
338338 assert "must contain a unique set of integers" not in log_entry ._cache_safety_message
339339
340340 self .table4 .write (self .fnames [num_scenario ], path = 'data' , overwrite = True )
341- f = h5py .File (self .fnames [num_scenario ])
341+ f = h5py .File (self .fnames [num_scenario ], 'a' )
342342 for attr in self .hard_coded_log_attrs :
343343 f .attrs [attr ] = getattr (log_entry , attr )
344344 f .attrs ['Lbox' ] = 100.
@@ -365,7 +365,7 @@ def test_scenario4a(self):
365365 bad_table ['halo_id' ] = np .arange (len (bad_table ), dtype = float )
366366 bad_table ['halo_id' ][0 ] = 0.1
367367 bad_table .write (self .fnames [num_scenario ], path = 'data' )
368- f = h5py .File (self .fnames [num_scenario ])
368+ f = h5py .File (self .fnames [num_scenario ], 'a' )
369369 for attr in self .hard_coded_log_attrs :
370370 f .attrs [attr ] = getattr (log_entry , attr )
371371 f .attrs ['Lbox' ] = 100.
@@ -390,7 +390,7 @@ def test_scenario4b(self):
390390 bad_table ['halo_rvir' ] = 0.
391391 bad_table ['halo_rvir' ][0 ] = 51
392392 bad_table .write (self .fnames [num_scenario ], path = 'data' )
393- f = h5py .File (self .fnames [num_scenario ])
393+ f = h5py .File (self .fnames [num_scenario ], 'a' )
394394 for attr in self .hard_coded_log_attrs :
395395 f .attrs [attr ] = getattr (log_entry , attr )
396396 f .attrs ['Lbox' ] = 100.
@@ -412,7 +412,7 @@ def test_passing_scenario(self):
412412 log_entry = HaloTableCacheLogEntry (** self .get_scenario_kwargs (num_scenario ))
413413
414414 self .good_table .write (self .fnames [num_scenario ], path = 'data' )
415- f = h5py .File (self .fnames [num_scenario ])
415+ f = h5py .File (self .fnames [num_scenario ], 'a' )
416416 for attr in self .hard_coded_log_attrs :
417417 f .attrs [attr ] = getattr (log_entry , attr )
418418 f .attrs ['Lbox' ] = 100.
0 commit comments