Skip to content

Commit 35a1439

Browse files
committed
BF: fixed test error when DISPLAY variable not available
1 parent 8661179 commit 35a1439

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

nipype/interfaces/freesurfer/tests/test_utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,13 @@ def test_surfshots():
227227
yield assert_equal, fotos.cmdline, "tksurfer fsaverage lh pial -tcl other.tcl"
228228

229229
# Test that the interface crashes politely if graphics aren't enabled
230-
hold_display = os.environ["DISPLAY"]
231-
del os.environ["DISPLAY"]
232-
yield assert_raises, RuntimeError, fotos.run
233-
os.environ["DISPLAY"] = hold_display
234-
230+
try:
231+
hold_display = os.environ["DISPLAY"]
232+
del os.environ["DISPLAY"]
233+
yield assert_raises, RuntimeError, fotos.run
234+
os.environ["DISPLAY"] = hold_display
235+
except KeyError:
236+
pass
237+
235238
# Clean up our mess
236239
clean_directory(cwd, oldwd)

0 commit comments

Comments
 (0)