Skip to content

Commit

Permalink
fix: add missing_ok to deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutterley committed Dec 3, 2024
1 parent e1c4111 commit 7b282dd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions test/test_download_and_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def download_CATS2008(self):
# clean up model
shutil.rmtree(modelpath)
# clean up
CFname.unlink()
CFname.unlink(missing_ok=True)

# PURPOSE: Download CATS2008 from AWS S3 bucket
@pytest.fixture(scope="class", autouse=True)
Expand Down Expand Up @@ -174,7 +174,7 @@ def AWS_CATS2008(self, aws_access_key_id, aws_secret_access_key, aws_region_name
# clean up model
shutil.rmtree(modelpath)
# clean up
CFname.unlink()
CFname.unlink(missing_ok=True)

# PURPOSE: Download Antarctic Tide Gauge Database from US Antarctic Program
@pytest.fixture(scope="class", autouse=False)
Expand All @@ -188,7 +188,7 @@ def download_AntTG(self):
# run tests
yield
# clean up
local.unlink()
local.unlink(missing_ok=True)

# PURPOSE: Download Antarctic Tide Gauge Database from AWS
@pytest.fixture(scope="class", autouse=True)
Expand All @@ -211,7 +211,7 @@ def AWS_AntTG(self, aws_access_key_id, aws_secret_access_key, aws_region_name):
# run tests
yield
# clean up
local.unlink()
local.unlink(missing_ok=True)

# PURPOSE: create verification from Matlab program
@pytest.fixture(scope="class", autouse=False)
Expand Down Expand Up @@ -938,7 +938,7 @@ def download_AOTIM5_2018(self):
# clean up model
shutil.rmtree(modelpath)
# clean up
CFname.unlink()
CFname.unlink(missing_ok=True)

# PURPOSE: Download Arctic Tidal Current Atlas list of records
@pytest.fixture(scope="class", autouse=True)
Expand All @@ -951,7 +951,7 @@ def download_Arctic_Tide_Atlas(self):
# run tests
yield
# clean up
local.unlink()
local.unlink(missing_ok=True)

# PURPOSE: create verification from Matlab program
@pytest.fixture(scope="class", autouse=False)
Expand Down
2 changes: 1 addition & 1 deletion test/test_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def download_nodes(N=324):
verbose=True)
yield
# remove the node file
filepath.joinpath(matfile).unlink()
filepath.joinpath(matfile).unlink(missing_ok=True)

# Franke's 3D evaluation function
def franke_3d(x,y,z):
Expand Down
4 changes: 2 additions & 2 deletions test/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_parquet():
# check that data is valid
assert np.all((np.abs(v-df[k].values) < eps) for k,v in output.items())
# remove the test file
output_file.unlink()
output_file.unlink(missing_ok=True)

# PURPOSE: test the read and write of geoparquet files
def test_geoparquet():
Expand Down Expand Up @@ -133,4 +133,4 @@ def test_geoparquet():
# check that data is valid
assert np.all((np.abs(v-gdf[k].values) < eps) for k,v in output.items())
# remove the test file
output_file.unlink()
output_file.unlink(missing_ok=True)
2 changes: 1 addition & 1 deletion test/test_solid_earth.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def download_jpl_ephemerides():
# run tests
yield
# clean up
de440s.unlink()
de440s.unlink(missing_ok=True)
else:
# run tests
yield
Expand Down
12 changes: 6 additions & 6 deletions test/test_spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_ascii():
eps = np.finfo(np.float32).eps
assert np.all((np.abs(v-test[k]) < eps) for k,v in output.items())
# remove the test file
output_file.unlink()
output_file.unlink(missing_ok=True)

# PURPOSE: test the read and write of netCDF4 files
@pytest.mark.parametrize("TYPE", ['drift','grid','time series'])
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_netCDF4(TYPE):
eps = np.finfo(np.float32).eps
assert np.all((np.abs(v-test[k]) < eps) for k,v in output.items())
# remove the test file
output_file.unlink()
output_file.unlink(missing_ok=True)

# PURPOSE: test the read and write of HDF5 files
@pytest.mark.parametrize("TYPE", ['drift','grid','time series'])
Expand Down Expand Up @@ -247,7 +247,7 @@ def test_HDF5(TYPE):
eps = np.finfo(np.float32).eps
assert np.all((np.abs(v-test[k]) < eps) for k,v in output.items())
# remove the test file
output_file.unlink()
output_file.unlink(missing_ok=True)

# PURPOSE: Download IODEM3 from NSIDC
@pytest.fixture(scope="module", autouse=False)
Expand All @@ -266,7 +266,7 @@ def nsidc_IODEM3(username, password):
# run tests
yield
# clean up
granule.unlink()
granule.unlink(missing_ok=True)

# PURPOSE: Download IODEM3 from AWS S3 bucket
@pytest.fixture(scope="module", autouse=True)
Expand All @@ -291,7 +291,7 @@ def AWS_IODEM3(aws_access_key_id, aws_secret_access_key, aws_region_name):
# run tests
yield
# clean up
granule.unlink()
granule.unlink(missing_ok=True)

# PURPOSE: test the read and write of geotiff files
def test_geotiff():
Expand Down Expand Up @@ -322,7 +322,7 @@ def test_geotiff():
eps = np.finfo(np.float32).eps
assert np.all((np.abs(v-test[k]) < eps) for k,v in dinput.items())
# remove the test files
output_file.unlink()
output_file.unlink(missing_ok=True)

# PURPOSE: test the default field mapping function
def test_field_mapping():
Expand Down

0 comments on commit 7b282dd

Please sign in to comment.