@@ -35,6 +35,8 @@ def test_display_config(monkeypatch, dispnum):
3535 config .set ('execution' , 'display_variable' , dispstr )
3636 monkeypatch .delitem (os .environ , 'DISPLAY' , raising = False )
3737 assert config .get_display () == config .get ('execution' , 'display_variable' )
38+ # Test that it was correctly cached
39+ assert config .get_display () == config .get ('execution' , 'display_variable' )
3840
3941
4042@pytest .mark .parametrize ('dispnum' , range (5 ))
@@ -45,6 +47,8 @@ def test_display_system(monkeypatch, dispnum):
4547 dispstr = ':%d' % dispnum
4648 monkeypatch .setitem (os .environ , 'DISPLAY' , dispstr )
4749 assert config .get_display () == dispstr
50+ # Test that it was correctly cached
51+ assert config .get_display () == dispstr
4852
4953
5054def test_display_config_and_system (monkeypatch ):
@@ -54,6 +58,8 @@ def test_display_config_and_system(monkeypatch):
5458 config .set ('execution' , 'display_variable' , dispstr )
5559 monkeypatch .setitem (os .environ , 'DISPLAY' , ':0' )
5660 assert config .get_display () == dispstr
61+ # Test that it was correctly cached
62+ assert config .get_display () == dispstr
5763
5864
5965def test_display_noconfig_nosystem_patched (monkeypatch ):
@@ -64,6 +70,8 @@ def test_display_noconfig_nosystem_patched(monkeypatch):
6470 monkeypatch .delitem (os .environ , 'DISPLAY' , raising = False )
6571 monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch )
6672 assert config .get_display () == ":2010"
73+ # Test that it was correctly cached
74+ assert config .get_display () == ':2010'
6775
6876
6977def test_display_empty_patched (monkeypatch ):
@@ -77,6 +85,8 @@ def test_display_empty_patched(monkeypatch):
7785 monkeypatch .setitem (os .environ , 'DISPLAY' , '' )
7886 monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch )
7987 assert config .get_display () == ':2010'
88+ # Test that it was correctly cached
89+ assert config .get_display () == ':2010'
8090
8191
8292def test_display_noconfig_nosystem_patched_oldxvfbwrapper (monkeypatch ):
@@ -90,6 +100,8 @@ def test_display_noconfig_nosystem_patched_oldxvfbwrapper(monkeypatch):
90100 monkeypatch .delitem (os .environ , 'DISPLAY' , raising = False )
91101 monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch_old )
92102 assert config .get_display () == ":2010"
103+ # Test that it was correctly cached
104+ assert config .get_display () == ':2010'
93105
94106
95107def test_display_empty_patched_oldxvfbwrapper (monkeypatch ):
@@ -103,6 +115,8 @@ def test_display_empty_patched_oldxvfbwrapper(monkeypatch):
103115 monkeypatch .setitem (os .environ , 'DISPLAY' , '' )
104116 monkeypatch .setitem (sys .modules , 'xvfbwrapper' , xvfbpatch_old )
105117 assert config .get_display () == ':2010'
118+ # Test that it was correctly cached
119+ assert config .get_display () == ':2010'
106120
107121
108122def test_display_noconfig_nosystem_notinstalled (monkeypatch ):
@@ -143,7 +157,10 @@ def test_display_noconfig_nosystem_installed(monkeypatch):
143157 if config .has_option ('execution' , 'display_variable' ):
144158 config ._config .remove_option ('execution' , 'display_variable' )
145159 monkeypatch .delitem (os .environ , 'DISPLAY' , raising = False )
146- assert int (config .get_display ().split (':' )[- 1 ]) > 1000
160+ newdisp = config .get_display ()
161+ assert int (newdisp .split (':' )[- 1 ]) > 1000
162+ # Test that it was correctly cached
163+ assert config .get_display () == newdisp
147164
148165
149166@pytest .mark .skipif (not has_Xvfb , reason = 'xvfbwrapper not installed' )
@@ -156,7 +173,10 @@ def test_display_empty_installed(monkeypatch):
156173 if config .has_option ('execution' , 'display_variable' ):
157174 config ._config .remove_option ('execution' , 'display_variable' )
158175 monkeypatch .setitem (os .environ , 'DISPLAY' , '' )
159- assert int (config .get_display ().split (':' )[- 1 ]) > 1000
176+ newdisp = config .get_display ()
177+ assert int (newdisp .split (':' )[- 1 ]) > 1000
178+ # Test that it was correctly cached
179+ assert config .get_display () == newdisp
160180
161181
162182def test_display_empty_macosx (monkeypatch ):
0 commit comments