Skip to content

Commit 08bccfa

Browse files
author
Shoshana Berleant
committed
run compcor tests in tempfile
1 parent 1c655f8 commit 08bccfa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

nipype/algorithms/tests/test_compcor.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import nibabel as nb
1010
import numpy as np
1111
import os
12+
import tempfile
13+
import shutil
1214

1315
class TestCompCor(unittest.TestCase):
1416
''' Note: Tests currently do a poor job of testing functionality '''
@@ -19,6 +21,9 @@ class TestCompCor(unittest.TestCase):
1921

2022
def setUp(self):
2123
# setup
24+
self.orig_dir = os.getcwd()
25+
self.temp_dir = tempfile.mkdtemp()
26+
os.chdir(self.temp_dir)
2227
noise = np.fromfunction(self.fake_noise_fun, self.fake_data.shape)
2328
self.realigned_file = utils.save_toy_nii(self.fake_data + noise,
2429
self.filenames['functionalnii'])
@@ -74,7 +79,8 @@ def run_cc(self, ccinterface, expected_components):
7479
return ccresult
7580

7681
def tearDown(self):
77-
utils.remove_nii(self.filenames.values())
82+
os.chdir(self.orig_dir)
83+
shutil.rmtree(self.temp_dir)
7884

7985
def fake_noise_fun(self, i, j, l, m):
8086
return m*i + l - j

0 commit comments

Comments
 (0)