Skip to content

Commit

Permalink
Revert "use testing.write_tmp_imgs"
Browse files Browse the repository at this point in the history
This reverts commit 244f0f3.
  • Loading branch information
Remi-Gau committed Aug 28, 2023
1 parent 244f0f3 commit 3ea9d0e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions nilearn/_utils/tests/test_niimg_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,18 @@ def test_iter_check_niimgs_error():
def test_iter_check_niimgs(tmp_path, img_4d_zeros_eye):
img_2_4d = [[img_4d_zeros_eye, img_4d_zeros_eye]]

with testing.write_tmp_imgs(
img_4d_zeros_eye, create_files=True
) as filename:
niimgs = list(_iter_check_niimg([filename]))
assert_array_equal(
get_data(niimgs[0]), get_data(_utils.check_niimg(img_4d_zeros_eye))
)
# Create a test file
fd, filename = tempfile.mkstemp(
prefix="nilearn_test", suffix=".nii", dir=str(tmp_path)
)
os.close(fd)
img_4d_zeros_eye.to_filename(filename)
niimgs = list(_iter_check_niimg([filename]))
assert_array_equal(
get_data(niimgs[0]), get_data(_utils.check_niimg(img_4d_zeros_eye))
)
del niimgs
os.remove(filename)

# Regular case
niimgs = list(_iter_check_niimg(img_2_4d))
Expand Down

0 comments on commit 3ea9d0e

Please sign in to comment.