From 562aa900c5e9bb67eb97edb8e76fd5e87f349581 Mon Sep 17 00:00:00 2001 From: Adam Ginsburg Date: Fri, 28 Oct 2022 09:12:04 -0400 Subject: [PATCH] try using context manager to avoid "unclosed file" error --- astroquery/desi/tests/test_desi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/astroquery/desi/tests/test_desi.py b/astroquery/desi/tests/test_desi.py index df62bb2bde..75f58e025e 100644 --- a/astroquery/desi/tests/test_desi.py +++ b/astroquery/desi/tests/test_desi.py @@ -96,9 +96,9 @@ def compare_result_data(result, data): def image_tester(images, filetype): assert type(images) == list - data = fits.open(data_path(DATA_FILES[filetype])) - assert images[0][0].header == data[0].header - assert np.array_equal(images[0][0].data, data[0].data) + with fits.open(data_path(DATA_FILES[filetype])) as data: + assert images[0][0].header == data[0].header + assert np.array_equal(images[0][0].data, data[0].data) def test_coords_query_region(patch_tap, coords=coords, radius=radius):