2121
2222@pytest .mark .parametrize ('dispnum' , range (5 ))
2323def test_display_config (monkeypatch , dispnum ):
24- """Check that the display_variable option is used"""
24+ """Check that the display_variable option is used ($DISPLAY not set) """
2525 config ._display = None
2626 dispstr = ':%d' % dispnum
2727 config .set ('execution' , 'display_variable' , dispstr )
@@ -44,12 +44,12 @@ def test_display_config_and_system(monkeypatch):
4444 config ._display = None
4545 dispstr = ':10'
4646 config .set ('execution' , 'display_variable' , dispstr )
47- monkeypatch .setitem (os .environ , 'DISPLAY' , dispstr )
47+ monkeypatch .setitem (os .environ , 'DISPLAY' , ':0' )
4848 assert config .get_display () == dispstr
4949
5050
5151def test_display_noconfig_nosystem_patched (monkeypatch ):
52- """Check that when no display is specified, a virtual Xvfb is used"""
52+ """Check that when no $DISPLAY nor option are specified, a virtual Xvfb is used"""
5353 config ._display = None
5454 if config .has_option ('execution' , 'display_variable' ):
5555 config ._config .remove_option ('execution' , 'display_variable' )
@@ -59,7 +59,10 @@ def test_display_noconfig_nosystem_patched(monkeypatch):
5959
6060
6161def test_display_empty_patched (monkeypatch ):
62- """Check that when no display is specified, a virtual Xvfb is used"""
62+ """
63+ Check that when $DISPLAY is empty string and no option is specified,
64+ a virtual Xvfb is used
65+ """
6366 config ._display = None
6467 if config .has_option ('execution' , 'display_variable' ):
6568 config ._config .remove_option ('execution' , 'display_variable' )
@@ -69,7 +72,10 @@ def test_display_empty_patched(monkeypatch):
6972
7073
7174def test_display_noconfig_nosystem_notinstalled (monkeypatch ):
72- """Check that when no display is specified, a virtual Xvfb is used"""
75+ """
76+ Check that an exception is raised if xvfbwrapper is not installed
77+ but necessary (no config and $DISPLAY unset)
78+ """
7379 config ._display = None
7480 if config .has_option ('execution' , 'display_variable' ):
7581 config ._config .remove_option ('execution' , 'display_variable' )
@@ -80,7 +86,10 @@ def test_display_noconfig_nosystem_notinstalled(monkeypatch):
8086
8187
8288def test_display_empty_notinstalled (monkeypatch ):
83- """Check that when no display is specified, a virtual Xvfb is used"""
89+ """
90+ Check that an exception is raised if xvfbwrapper is not installed
91+ but necessary (no config and $DISPLAY empty)
92+ """
8493 config ._display = None
8594 if config .has_option ('execution' , 'display_variable' ):
8695 config ._config .remove_option ('execution' , 'display_variable' )
@@ -92,7 +101,10 @@ def test_display_empty_notinstalled(monkeypatch):
92101
93102@pytest .mark .skipif (not has_Xvfb , reason = 'xvfbwrapper not installed' )
94103def test_display_noconfig_nosystem_installed (monkeypatch ):
95- """Check that when no display is specified, a virtual Xvfb is used"""
104+ """
105+ Check that actually uses xvfbwrapper when installed (not mocked)
106+ and necessary (no config and $DISPLAY unset)
107+ """
96108 config ._display = None
97109 if config .has_option ('execution' , 'display_variable' ):
98110 config ._config .remove_option ('execution' , 'display_variable' )
@@ -102,7 +114,10 @@ def test_display_noconfig_nosystem_installed(monkeypatch):
102114
103115@pytest .mark .skipif (not has_Xvfb , reason = 'xvfbwrapper not installed' )
104116def test_display_empty_installed (monkeypatch ):
105- """Check that when no display is specified, a virtual Xvfb is used"""
117+ """
118+ Check that actually uses xvfbwrapper when installed (not mocked)
119+ and necessary (no config and $DISPLAY empty)
120+ """
106121 config ._display = None
107122 if config .has_option ('execution' , 'display_variable' ):
108123 config ._config .remove_option ('execution' , 'display_variable' )
@@ -111,7 +126,11 @@ def test_display_empty_installed(monkeypatch):
111126
112127
113128def test_display_empty_macosx (monkeypatch ):
114- """Check that when no display is specified, a virtual Xvfb is used"""
129+ """
130+ Check that an exception is raised if xvfbwrapper is necessary
131+ (no config and $DISPLAY unset) but platform is OSX. See
132+ https://github.com/nipy/nipype/issues/1400
133+ """
115134 config ._display = None
116135 if config .has_option ('execution' , 'display_variable' ):
117136 config ._config .remove_option ('execution' , 'display_variable' )
0 commit comments