Skip to content

Commit e848739

Browse files
committed
fix: nitime test failure when display is missing
1 parent b6bc09a commit e848739

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nipype/interfaces/nitime/tests/test_nitime.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
22
# vi: set ft=python sts=4 ts=4 sw=4 et:
3+
import os
34
import tempfile
45

56
import numpy as np
@@ -9,6 +10,7 @@
910
import nipype.interfaces.nitime as nitime
1011

1112
no_nitime = not nitime.analysis.have_nitime
13+
display_available = 'DISPLAY' in os.environ and os.environ['DISPLAY']
1214

1315
@skipif(no_nitime)
1416
def test_read_csv():
@@ -35,8 +37,9 @@ def test_coherence_analysis():
3537
CA = nitime.CoherenceAnalyzer()
3638
CA.inputs.TR = 1.89
3739
CA.inputs.in_file = example_data('fmri_timeseries.csv')
38-
tmp_png = tempfile.mkstemp(suffix='.png')[1]
39-
CA.inputs.output_figure_file = tmp_png
40+
if display_available:
41+
tmp_png = tempfile.mkstemp(suffix='.png')[1]
42+
CA.inputs.output_figure_file = tmp_png
4043
tmp_csv = tempfile.mkstemp(suffix='.csv')[1]
4144
CA.inputs.output_csv_file = tmp_csv
4245

0 commit comments

Comments
 (0)