Skip to content

Commit 562aa90

Browse files
keflavichbsipocz
authored andcommitted
try using context manager to avoid "unclosed file" error
1 parent cb67fcd commit 562aa90

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

astroquery/desi/tests/test_desi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def compare_result_data(result, data):
9696

9797
def image_tester(images, filetype):
9898
assert type(images) == list
99-
data = fits.open(data_path(DATA_FILES[filetype]))
100-
assert images[0][0].header == data[0].header
101-
assert np.array_equal(images[0][0].data, data[0].data)
99+
with fits.open(data_path(DATA_FILES[filetype])) as data:
100+
assert images[0][0].header == data[0].header
101+
assert np.array_equal(images[0][0].data, data[0].data)
102102

103103

104104
def test_coords_query_region(patch_tap, coords=coords, radius=radius):

0 commit comments

Comments
 (0)