21
21
22
22
@pytest .mark .parametrize ('dispnum' , range (5 ))
23
23
def 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) """
25
25
config ._display = None
26
26
dispstr = ':%d' % dispnum
27
27
config .set ('execution' , 'display_variable' , dispstr )
@@ -44,12 +44,12 @@ def test_display_config_and_system(monkeypatch):
44
44
config ._display = None
45
45
dispstr = ':10'
46
46
config .set ('execution' , 'display_variable' , dispstr )
47
- monkeypatch .setitem (os .environ , 'DISPLAY' , dispstr )
47
+ monkeypatch .setitem (os .environ , 'DISPLAY' , ':0' )
48
48
assert config .get_display () == dispstr
49
49
50
50
51
51
def 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"""
53
53
config ._display = None
54
54
if config .has_option ('execution' , 'display_variable' ):
55
55
config ._config .remove_option ('execution' , 'display_variable' )
@@ -59,7 +59,10 @@ def test_display_noconfig_nosystem_patched(monkeypatch):
59
59
60
60
61
61
def 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
+ """
63
66
config ._display = None
64
67
if config .has_option ('execution' , 'display_variable' ):
65
68
config ._config .remove_option ('execution' , 'display_variable' )
@@ -69,7 +72,10 @@ def test_display_empty_patched(monkeypatch):
69
72
70
73
71
74
def 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
+ """
73
79
config ._display = None
74
80
if config .has_option ('execution' , 'display_variable' ):
75
81
config ._config .remove_option ('execution' , 'display_variable' )
@@ -80,7 +86,10 @@ def test_display_noconfig_nosystem_notinstalled(monkeypatch):
80
86
81
87
82
88
def 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
+ """
84
93
config ._display = None
85
94
if config .has_option ('execution' , 'display_variable' ):
86
95
config ._config .remove_option ('execution' , 'display_variable' )
@@ -92,7 +101,10 @@ def test_display_empty_notinstalled(monkeypatch):
92
101
93
102
@pytest .mark .skipif (not has_Xvfb , reason = 'xvfbwrapper not installed' )
94
103
def 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
+ """
96
108
config ._display = None
97
109
if config .has_option ('execution' , 'display_variable' ):
98
110
config ._config .remove_option ('execution' , 'display_variable' )
@@ -102,7 +114,10 @@ def test_display_noconfig_nosystem_installed(monkeypatch):
102
114
103
115
@pytest .mark .skipif (not has_Xvfb , reason = 'xvfbwrapper not installed' )
104
116
def 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
+ """
106
121
config ._display = None
107
122
if config .has_option ('execution' , 'display_variable' ):
108
123
config ._config .remove_option ('execution' , 'display_variable' )
@@ -111,7 +126,11 @@ def test_display_empty_installed(monkeypatch):
111
126
112
127
113
128
def 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
+ """
115
134
config ._display = None
116
135
if config .has_option ('execution' , 'display_variable' ):
117
136
config ._config .remove_option ('execution' , 'display_variable' )
0 commit comments