From 04614e6e6ba2c6052daa14c1135b35597be85ba7 Mon Sep 17 00:00:00 2001 From: teald Date: Tue, 10 Sep 2024 15:48:24 -0700 Subject: [PATCH] =?UTF-8?q?fix(test):=20=F0=9F=90=9B=20Remove=20context=20?= =?UTF-8?q?manager=20syntax=20for=20chdir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_wcs.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/unit/test_wcs.py b/tests/unit/test_wcs.py index ab5f5d80..1af04b9e 100644 --- a/tests/unit/test_wcs.py +++ b/tests/unit/test_wcs.py @@ -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 @@ -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)