Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
36843ba3
Commit
36843ba3
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Some small adjustments to idle tests to simulate wx not installed
parent
b95875cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_idle.py
+12
-4
12 additions, 4 deletions
tests/test_idle.py
with
12 additions
and
4 deletions
tests/test_idle.py
+
12
−
4
View file @
36843ba3
...
@@ -71,6 +71,11 @@ def _run_with_wx(func, *args, **kwargs):
...
@@ -71,6 +71,11 @@ def _run_with_wx(func, *args, **kwargs):
return
result
[
0
]
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
():
def
_wait_for_idle_loop_to_clear
():
if
fslplatform
.
haveGui
:
if
fslplatform
.
haveGui
:
...
@@ -86,8 +91,8 @@ def _wait_for_idle_loop_to_clear():
...
@@ -86,8 +91,8 @@ def _wait_for_idle_loop_to_clear():
wx
.
Yield
()
wx
.
Yield
()
def
test_run_with_gui
():
_run_with_wx
(
_test_run
)
def
test_run_with_gui
():
_run_with_wx
(
_test_run
)
def
test_run_without_gui
():
_test_run
(
)
def
test_run_without_gui
():
_run_without_wx
(
_test_run
)
def
_test_run
():
def
_test_run
():
taskRun
=
[
False
]
taskRun
=
[
False
]
...
@@ -138,7 +143,10 @@ def _test_run():
...
@@ -138,7 +143,10 @@ def _test_run():
assert
onErrorCalled
[
0
]
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
()
idle
.
idleReset
()
default
=
idle
.
getIdleTimeout
()
default
=
idle
.
getIdleTimeout
()
idle
.
setIdleTimeout
(
999
)
idle
.
setIdleTimeout
(
999
)
...
@@ -160,7 +168,7 @@ def test_idle():
...
@@ -160,7 +168,7 @@ def test_idle():
assert
idle
.
getIdleTimeout
()
>
0
assert
idle
.
getIdleTimeout
()
>
0
# Run directly
# Run directly
idle
.
idle
(
task
,
1
,
kwarg1
=
2
,
name
=
'
direct
'
)
_run_without_wx
(
idle
.
idle
,
task
,
1
,
kwarg1
=
2
,
name
=
'
direct
'
)
assert
called
[
0
]
assert
called
[
0
]
called
[
0
]
=
False
called
[
0
]
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment