Skip to content
Snippets Groups Projects
Commit 28fd80c1 authored by Martin Craig's avatar Martin Craig
Browse files

Allow the mock FSLDIR to create dummy files in specified subdirectories

This is because the logic for selecting a command now checks for
a file actually existing in FSLDEVDIR, FSLDIR etc, so we need to
make sure a corresponding file actually exists before doing a command
line wrapper test
parent 73e55b58
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ logging.getLogger().setLevel(logging.WARNING)
@contextlib.contextmanager
def mockFSLDIR():
def mockFSLDIR(**kwargs):
oldfsldir = fslplatform.fsldir
oldfsldevdir = fslplatform.fsldevdir
......@@ -45,6 +45,12 @@ def mockFSLDIR():
fsldir = op.join(td, 'fsl')
bindir = op.join(fsldir, 'bin')
os.makedirs(bindir)
for subdir, files in kwargs.items():
subdir = op.join(fsldir, subdir)
if not op.isdir(subdir):
os.makedirs(subdir)
for fname in files:
touch(op.join(subdir, fname))
fslplatform.fsldir = fsldir
fslplatform.fsldevdir = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment