Skip to content

Commit efb4719

Browse files
author
Félix C. Morency
committed
TEST: Use tmpdirs instead of tempfile
1 parent c83870d commit efb4719

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

nibabel/tests/test_ecat.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from __future__ import with_statement
1010

1111
import os
12-
import tempfile
1312

1413
import numpy as np
1514

@@ -26,6 +25,7 @@
2625
from numpy.testing import assert_array_equal, assert_array_almost_equal
2726

2827
from ..testing import data_path
28+
from ..tmpdirs import InTemporaryDirectory
2929

3030
ecat_file = os.path.join(data_path, 'tinypet.v')
3131

@@ -200,9 +200,10 @@ def test_file(self):
200200
self.example_file)
201201

202202
def test_save(self):
203-
with tempfile.NamedTemporaryFile(suffix='.v') as tmp_file:
204-
self.img.to_filename(tmp_file.name)
205-
other = self.image_class.load(tmp_file.name)
203+
tmp_file = 'tinypet_tmp.v'
204+
with InTemporaryDirectory() as tmp_dir:
205+
self.img.to_filename(tmp_file)
206+
other = self.image_class.load(tmp_file)
206207
assert_equal(self.img.get_data().all(), other.get_data().all())
207208

208209
def test_data(self):

0 commit comments

Comments
 (0)