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
beat
beat.core
Commits
8a3e9811
Commit
8a3e9811
authored
Mar 14, 2019
by
Samuel GAIST
Browse files
[test][helpers] Code cleanup
parent
c450aa3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
beat/core/test/cpu_stress.py
View file @
8a3e9811
...
...
@@ -56,7 +56,7 @@ def test(x):
def
main
():
nworkers
=
int
(
sys
.
argv
[
1
])
pool
=
multiprocessing
.
Pool
(
processes
=
nworkers
)
result
=
pool
.
map_async
(
test
,
range
(
nworkers
))
pool
.
map_async
(
test
,
range
(
nworkers
))
pool
.
close
()
pool
.
join
()
...
...
beat/core/test/mocks.py
View file @
8a3e9811
...
...
@@ -88,8 +88,8 @@ class MockDataSink(DataSink):
class
MockDataSource_Crash
(
DataSource
):
def
next
(
self
):
a
=
b
a
=
b
# noqa
def
hasMoreData
(
self
):
a
=
b
a
=
b
# noqa
return
False
beat/core/test/utils.py
View file @
8a3e9811
...
...
@@ -46,14 +46,13 @@ import docker
# ----------------------------------------------------------
# Images used for docker-enabled tests within this and other BEAT packages
DOCKER_TEST_IMAGES
=
{
"docker.idiap.ch/beat/beat.env.system.python"
:
"1.3.0r4"
,
"docker.idiap.ch/beat/beat.env.db.examples"
:
"1.4.0r4"
,
"docker.idiap.ch/beat/beat.env.cxx"
:
"2.0.0r1"
,
"docker.idiap.ch/beat/beat.env.client"
:
"2.0.0r1"
,
}
"""Images used for docker-enabled tests within this and other BEAT packages
"""
def
pull_docker_test_images
():
...
...
@@ -158,13 +157,22 @@ def skipif(skip_condition, msg=None):
"""
class
SkipCallable
:
"""Helper class to handle both callable and boolean conditions"""
def
__init__
(
self
,
skip_condition
):
self
.
skip_condition
=
skip_condition
def
__call__
(
self
):
if
callable
(
self
.
skip_condition
):
return
skip_condition
()
else
:
return
self
.
skip_condition
def
skip_decorator
(
f
):
# Allow for both boolean or callable skip conditions.
if
callable
(
skip_condition
):
skip_val
=
lambda
:
skip_condition
()
else
:
skip_val
=
lambda
:
skip_condition
skip_val
=
SkipCallable
(
skip_condition
)
# We need to define *two* skippers because Python doesn't allow both
# return with value and yield inside the same function.
...
...
Write
Preview
Markdown
is supported
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