-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi, this issue is part of this package's pyOpenSci review at pyOpenSci/software-submission#244
Severity: Moderate
Description
Getting some failing tests on my WIndows laptop:
==== 22 failed, 868 passed, 12 warnings, 787 errors in 290.12s (0:04:50) ===
Most of the errors are PermissionErrors: e.g.,
ERROR tests/test_masking.py::TestMaskingNamedColumnDatasets::test_bool_mask[False] - PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'demo_data\toysnap.hdf5'
Here is a snippet from some of the more detailed tracebacks:
________________________________________________________________________________________________________ TestMaskingSWIFTGalaxy.test_mask_without_spatial_mask ________________________________________________________________________________________________________
self = <test_masking.TestMaskingSWIFTGalaxy object at 0x0000027FAC893910>
def test_mask_without_spatial_mask(self): """ Check that if we have no masks we read everything in the box (and warn about it). Then that we can still apply an extra mask, and a second one (there's specific logic for applying two consecutively). """ try: _create_toysnap() sg = SWIFTGalaxy( _toysnap_filename, None, # no halo_catalogue is easiest way to get no mask transforms_like_coordinates={"coordinates", "extra_coordinates"}, transforms_like_velocities={"velocities", "extra_velocities"}, ) # check that extra mask is blank for all particle types: assert sg._extra_mask.gas is None assert sg._extra_mask.dark_matter is None assert sg._extra_mask.stars is None assert sg._extra_mask.black_holes is None # check that cell mask is blank for all particle types: assert sg._spatial_mask is None # check that we read all the particles: assert sg.gas.masses.size == _n_g_all assert sg.dark_matter.masses.size == _n_dm_all assert sg.stars.masses.size == _n_s_all assert sg.black_holes.masses.size == _n_bh_all # now apply an extra mask sg.mask_particles(MaskCollection(gas=np.s_[:1000])) assert sg.gas.masses.size == 1000 # and the second consecutive one sg.mask_particles(MaskCollection(gas=np.s_[:100])) assert sg.gas.masses.size == 100 finally:_remove_toysnap()tests\test_masking.py:122:
swiftgalaxy\demo_data.py:1078: in _remove_toysnap
Path(snapfile).unlink(missing_ok=True)
self = WindowsPath('demo_data/toysnap.hdf5'), missing_ok = True
def unlink(self, missing_ok=False): """ Remove this file or link. If the path is a directory, use rmdir() instead. """ try:self._accessor.unlink(self)E PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'demo_data\toysnap.hdf5'
They seem to be related to demo data file handling during breakdown. From my web searching it seems like maybe files need to closed (file.close()) before un-linking on Windows, but I'm not positive if that will fix it.