Skip to content

Commit f847fa7

Browse files
authored
Merge pull request #3193 from effigies/test/mock_terminal_output
TEST: Mock terminal output before testing changing default value
2 parents 1ca5d4e + 5c69cd1 commit f847fa7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

nipype/interfaces/base/tests/test_core.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import simplejson as json
66

77
import pytest
8+
from unittest import mock
89

910
from .... import config
1011
from ....testing import example_data
@@ -456,17 +457,18 @@ def test_global_CommandLine_output(tmpdir):
456457
ci = BET()
457458
assert ci.terminal_output == "stream" # default case
458459

459-
nib.CommandLine.set_default_terminal_output("allatonce")
460-
ci = nib.CommandLine(command="ls -l")
461-
assert ci.terminal_output == "allatonce"
460+
with mock.patch.object(nib.CommandLine, '_terminal_output'):
461+
nib.CommandLine.set_default_terminal_output("allatonce")
462+
ci = nib.CommandLine(command="ls -l")
463+
assert ci.terminal_output == "allatonce"
462464

463-
nib.CommandLine.set_default_terminal_output("file")
464-
ci = nib.CommandLine(command="ls -l")
465-
assert ci.terminal_output == "file"
465+
nib.CommandLine.set_default_terminal_output("file")
466+
ci = nib.CommandLine(command="ls -l")
467+
assert ci.terminal_output == "file"
466468

467-
# Check default affects derived interfaces
468-
ci = BET()
469-
assert ci.terminal_output == "file"
469+
# Check default affects derived interfaces
470+
ci = BET()
471+
assert ci.terminal_output == "file"
470472

471473

472474
def test_CommandLine_prefix(tmpdir):

nipype/interfaces/tests/test_extra_dcm2nii.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _fetch_data(datadir, dicoms):
2222
"""Fetches some test DICOMs using datalad"""
2323
api.install(path=datadir, source=DICOM_DIR)
2424
data = os.path.join(datadir, dicoms)
25-
api.get(path=data)
25+
api.get(path=data, dataset=datadir)
2626
except IncompleteResultsError as exc:
2727
pytest.skip("Failed to fetch test data: %s" % str(exc))
2828
return data
@@ -32,7 +32,6 @@ def _fetch_data(datadir, dicoms):
3232

3333
@pytest.mark.skipif(no_datalad, reason="Datalad required")
3434
@pytest.mark.skipif(no_dcm2niix, reason="Dcm2niix required")
35-
@pytest.mark.xfail(reason="Intermittent failures. Let's come back to this later.")
3635
def test_dcm2niix_dti(fetch_data, tmpdir):
3736
tmpdir.chdir()
3837
datadir = tmpdir.mkdir("data").strpath

0 commit comments

Comments
 (0)