Skip to content

Commit

Permalink
fix(test): πŸ› Remove context manager syntax for chdir
Browse files Browse the repository at this point in the history
  • Loading branch information
teald committed Nov 5, 2024
1 parent 515892d commit 04614e6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/unit/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ def test_loglinear_axis(NIRI_IMAGE, tmp_path, monkeypatch):
new_coords = ad[0].wcs(2, 200, 300)
assert_allclose(coords, new_coords[1:])

with monkeypatch.chdir(tmp_path):
ad.write("test.fits", overwrite=True)
ad2 = astrodata.from_file("test.fits")
assert_allclose(ad2[0].wcs(2, 200, 300), new_coords)
monkeypatch.chdir(tmp_path)

ad.write("test.fits", overwrite=True)
ad2 = astrodata.from_file("test.fits")
assert_allclose(ad2[0].wcs(2, 200, 300), new_coords)

@pytest.mark.skip(reason="Requires external test data.")
@pytest.mark.preprocessed_data
Expand All @@ -277,8 +278,9 @@ def test_tabular1D_axis(tmp_path, monkeypatch):
assert ad[0].wcs(0) == pytest.approx(3017.51065254)
assert ad[0].wcs(1021) == pytest.approx(4012.89510727)

with monkeypatch.chdir(tmp_path):
ad.write("test.fits", overwrite=True)
ad2 = astrodata.open("test.fits")
assert ad2[0].wcs(0) == pytest.approx(3017.51065254)
assert ad2[0].wcs(1021) == pytest.approx(4012.89510727)
monkeypatch.chdir(tmp_path)

ad.write("test.fits", overwrite=True)
ad2 = astrodata.open("test.fits")
assert ad2[0].wcs(0) == pytest.approx(3017.51065254)
assert ad2[0].wcs(1021) == pytest.approx(4012.89510727)

0 comments on commit 04614e6

Please sign in to comment.