Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michiel Cottaar
fslpy
Commits
36843ba3
Commit
36843ba3
authored
Jan 12, 2018
by
Paul McCarthy
🚵
Browse files
Some small adjustments to idle tests to simulate wx not installed
parent
b95875cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_idle.py
View file @
36843ba3
...
...
@@ -71,6 +71,11 @@ def _run_with_wx(func, *args, **kwargs):
return
result
[
0
]
def
_run_without_wx
(
func
,
*
args
,
**
kwargs
):
with
mock
.
patch
.
dict
(
'sys.modules'
,
wx
=
None
):
return
func
(
*
args
,
**
kwargs
)
def
_wait_for_idle_loop_to_clear
():
if
fslplatform
.
haveGui
:
...
...
@@ -86,8 +91,8 @@ def _wait_for_idle_loop_to_clear():
wx
.
Yield
()
def
test_run_with_gui
():
_run_with_wx
(
_test_run
)
def
test_run_without_gui
():
_test_run
(
)
def
test_run_with_gui
():
_run_with_wx
(
_test_run
)
def
test_run_without_gui
():
_run_without_wx
(
_test_run
)
def
_test_run
():
taskRun
=
[
False
]
...
...
@@ -138,7 +143,10 @@ def _test_run():
assert
onErrorCalled
[
0
]
def
test_idleTimeout
():
def
test_idleTimeout_with_gui
():
_run_with_wx
(
_test_idleTimeout
)
def
test_idleTimeout_without_gui
():
_run_without_wx
(
_test_idleTimeout
)
def
_test_idleTimeout
():
idle
.
idleReset
()
default
=
idle
.
getIdleTimeout
()
idle
.
setIdleTimeout
(
999
)
...
...
@@ -160,7 +168,7 @@ def test_idle():
assert
idle
.
getIdleTimeout
()
>
0
# Run directly
idle
.
idle
(
task
,
1
,
kwarg1
=
2
,
name
=
'direct'
)
_run_without_wx
(
idle
.
idle
,
task
,
1
,
kwarg1
=
2
,
name
=
'direct'
)
assert
called
[
0
]
called
[
0
]
=
False
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment