Skip to content

Commit

Permalink
Unlink with missing_ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobson committed Feb 5, 2024
1 parent fe55037 commit d7af934
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/test_geospatial_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ def test_reproject_raster():
assert src.crs.to_string() == target_crs
finally:
# Regardless of test outcome, delete the temp file
if fid.exists():
fid.unlink()
if new_fid.exists():
new_fid.unlink()
fid.unlink(missing_ok=True)
new_fid.unlink(missing_ok=True)


def almost_equal(a, b, tol=1e-6):
Expand Down Expand Up @@ -216,10 +214,8 @@ def test_burn_shape_in_raster():
assert (data != data_).any()
finally:
# Regardless of test outcome, delete the temp file
if raster_fid.exists():
raster_fid.unlink()
if new_raster_fid.exists():
new_raster_fid.unlink()
raster_fid.unlink(missing_ok=True)
new_raster_fid.unlink(missing_ok=True)

def test_derive_subcatchments():
"""Test the derive_subcatchments function."""
Expand Down

0 comments on commit d7af934

Please sign in to comment.