Skip to content

Commit 248e503

Browse files
committed
fix: fixed provenance test and fatfs test
1 parent c2e95f2 commit 248e503

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

nipype/utils/tests/test_filemanip.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from tempfile import mkstemp, mkdtemp
77
import warnings
88

9-
from nipype.testing import assert_equal, assert_true, assert_false, TempFATFS
10-
from nipype.utils.filemanip import (save_json, load_json,
9+
from ...testing import assert_equal, assert_true, assert_false, TempFATFS
10+
from ...utils.filemanip import (save_json, load_json,
1111
fname_presuffix, fnames_presuffix,
1212
hash_rename, check_forhash,
1313
copyfile, copyfiles,
@@ -176,7 +176,7 @@ def test_copyfallback():
176176
pth, hdrname = os.path.split(orig_hdr)
177177
try:
178178
fatfs = TempFATFS()
179-
except IOError:
179+
except (IOError, OSError):
180180
warnings.warn('Fuse mount failed. copyfile fallback tests skipped.')
181181
else:
182182
with fatfs as fatdir:

nipype/utils/tests/test_provenance.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from ..provenance import ProvStore, safe_encode, text_type
1313

14-
1514
def test_provenance():
1615
ps = ProvStore()
1716
from ...interfaces.base import CommandLine
@@ -26,9 +25,16 @@ def test_provenance_exists():
2625
cwd = os.getcwd()
2726
os.chdir(tempdir)
2827
from ...interfaces.base import CommandLine
28+
from ... import config
29+
provenance_state = config.get('execution', 'write_provenance')
30+
hash_state = config.get('execution', 'hash_method')
31+
config.enable_provenance()
2932
CommandLine('echo hello').run()
33+
config.set('execution', 'write_provenance', provenance_state)
34+
config.set('execution', 'hash_method', hash_state)
35+
provenance_exists = os.path.exists(os.path.join(tempdir, 'provenance.provn'))
3036
os.chdir(cwd)
31-
yield assert_true, os.path.exists(os.path.join(tempdir, 'provenance.provn'))
37+
yield assert_true, provenance_exists
3238

3339
def test_safe_encode():
3440
a = '\xc3\xa9lg'

0 commit comments

Comments
 (0)