@@ -32,7 +32,7 @@ def test_display_parse(monkeypatch, disp_var):
32
32
"""Check that when $DISPLAY is defined, the display is correctly parsed"""
33
33
config ._display = None
34
34
dispstr = ':0'
35
- monkeypatch .setitem ( os . environ , 'DISPLAY' , disp_var )
35
+ monkeypatch .setenv ( 'DISPLAY' , disp_var )
36
36
assert config .get_display () == dispstr
37
37
# Test that it was correctly cached
38
38
assert config .get_display () == dispstr
@@ -56,7 +56,7 @@ def test_display_system(monkeypatch, dispnum):
56
56
config ._display = None
57
57
config ._config .remove_option ('execution' , 'display_variable' )
58
58
dispstr = ':%d' % dispnum
59
- monkeypatch .setitem ( os . environ , 'DISPLAY' , dispstr )
59
+ monkeypatch .setenv ( 'DISPLAY' , dispstr )
60
60
assert config .get_display () == dispstr
61
61
# Test that it was correctly cached
62
62
assert config .get_display () == dispstr
@@ -67,7 +67,7 @@ def test_display_config_and_system(monkeypatch):
67
67
config ._display = None
68
68
dispstr = ':10'
69
69
config .set ('execution' , 'display_variable' , dispstr )
70
- monkeypatch .setitem ( os . environ , 'DISPLAY' , ':0' )
70
+ monkeypatch .setenv ( 'DISPLAY' , ':0' )
71
71
assert config .get_display () == dispstr
72
72
# Test that it was correctly cached
73
73
assert config .get_display () == dispstr
@@ -93,7 +93,7 @@ def test_display_empty_patched(monkeypatch):
93
93
config ._display = None
94
94
if config .has_option ('execution' , 'display_variable' ):
95
95
config ._config .remove_option ('execution' , 'display_variable' )
96
- monkeypatch .setitem ( os . environ , 'DISPLAY' , '' )
96
+ monkeypatch .setenv ( 'DISPLAY' , '' )
97
97
monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch )
98
98
assert config .get_display () == ':2010'
99
99
# Test that it was correctly cached
@@ -123,7 +123,7 @@ def test_display_empty_patched_oldxvfbwrapper(monkeypatch):
123
123
config ._display = None
124
124
if config .has_option ('execution' , 'display_variable' ):
125
125
config ._config .remove_option ('execution' , 'display_variable' )
126
- monkeypatch .setitem ( os . environ , 'DISPLAY' , '' )
126
+ monkeypatch .setenv ( 'DISPLAY' , '' )
127
127
monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch_old )
128
128
assert config .get_display () == ':2010'
129
129
# Test that it was correctly cached
@@ -152,7 +152,7 @@ def test_display_empty_notinstalled(monkeypatch):
152
152
config ._display = None
153
153
if config .has_option ('execution' , 'display_variable' ):
154
154
config ._config .remove_option ('execution' , 'display_variable' )
155
- monkeypatch .setitem ( os . environ , 'DISPLAY' , '' )
155
+ monkeypatch .setenv ( 'DISPLAY' , '' )
156
156
monkeypatch .setitem (sys .modules , 'xvfbwrapper' , None )
157
157
with pytest .raises (RuntimeError ):
158
158
config .get_display ()
@@ -183,7 +183,7 @@ def test_display_empty_installed(monkeypatch):
183
183
config ._display = None
184
184
if config .has_option ('execution' , 'display_variable' ):
185
185
config ._config .remove_option ('execution' , 'display_variable' )
186
- monkeypatch .setitem ( os . environ , 'DISPLAY' , '' )
186
+ monkeypatch .setenv ( 'DISPLAY' , '' )
187
187
newdisp = config .get_display ()
188
188
assert int (newdisp .split (':' )[- 1 ]) > 1000
189
189
# Test that it was correctly cached
0 commit comments