Skip to content
Snippets Groups Projects
Commit 184f2938 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Adjust idle unit test

parent c4a3d769
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,11 @@ def _run_with_wx(func, *args, **kwargs): ...@@ -38,6 +38,11 @@ def _run_with_wx(func, *args, **kwargs):
if callAfterApp is not None: if callAfterApp is not None:
callAfterApp() callAfterApp()
# canHaveGui caches its return val,
# so clear it otherwise we may
# affect subsequent tests
idle._canHaveGui.cache_clear()
def wrap(): def wrap():
try: try:
...@@ -64,6 +69,8 @@ def _run_with_wx(func, *args, **kwargs): ...@@ -64,6 +69,8 @@ def _run_with_wx(func, *args, **kwargs):
idle.idleLoop.reset() idle.idleLoop.reset()
idle._canHaveGui.cache_clear()
if raised[0] and propagateRaise: if raised[0] and propagateRaise:
raise raised[0] raise raised[0]
...@@ -413,10 +420,9 @@ def test_idle_alwaysQueue4(): ...@@ -413,10 +420,9 @@ def test_idle_alwaysQueue4():
import fsl.utils.platform import fsl.utils.platform
with mock.patch.dict('sys.modules', {'wx' : None}): with mock.patch.dict('sys.modules', {'wx' : None}):
# idle uses the platform module to # The idle._canHaveGui caches its result,
# determine whether a GUI is available, # so we need to invalidate it
# so we have to reload it idle._canHaveGui.cache_clear()
reload_module(fsl.utils.platform)
idle.idle(task, alwaysQueue=True) idle.idle(task, alwaysQueue=True)
with pytest.raises(ImportError): with pytest.raises(ImportError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment