Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
pyMOR
pymor
Commits
db823cc0
Unverified
Commit
db823cc0
authored
Jun 20, 2022
by
René Fritze
Browse files
[tests] rewire `skip_if_missing` to not pre-emptively skip
parent
2e330257
Pipeline
#146047
passed with stages
in 39 minutes and 16 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/pymortests/base.py
View file @
db823cc0
...
...
@@ -12,10 +12,9 @@ import hypothesis
import
numpy
as
np
from
pickle
import
dump
,
load
from
pkg_resources
import
resource_filename
,
resource_stream
from
pytest
import
skip
,
fail
from
pytest
import
skip
from
pymor.algorithms.basic
import
almost_equal
,
relative_error
from
pymor.core.config
import
config
from
pymor.core.exceptions
import
DependencyMissing
...
...
@@ -97,19 +96,25 @@ def might_exceed_deadline(deadline=-1):
return
_outer_wrapper
def
skip_if_missing
(
module_name
):
"""Wrapper for requiring certain module dependencies on tests."""
def
skip_if_missing
(
config_name
):
"""Wrapper for requiring certain module dependencies on tests.
Parameters
----------
config_name
if `pymor.core.config.HAVE_config_name` evaluates to `False` and we're not in the
Docker CI environment, the test is skipped.
"""
def
_outer_wrapper
(
func
):
@
wraps
(
func
)
def
_inner_wrapper
(
*
args
,
**
kwargs
):
try
:
config
.
require
(
module_name
)
except
DependencyMissing
:
if
not
os
.
environ
.
get
(
'DOCKER_PYMOR'
,
False
):
skip_string
=
'skipped test due to missing dependency '
+
module_name
func
(
*
args
,
**
kwargs
)
except
DependencyMissing
as
dm
:
# skip does not return
if
config_name
in
str
(
dm
.
dependency
)
and
not
os
.
environ
.
get
(
'DOCKER_PYMOR'
,
False
):
skip_string
=
'skipped test due to missing dependency '
+
config_name
skip
(
skip_string
)
fail_string
=
'failed test due to missing dependency '
+
module_name
fail
(
fail_string
)
func
(
*
args
,
**
kwargs
)
raise
dm
return
_inner_wrapper
return
_outer_wrapper
src/pymortests/lyapunov.py
View file @
db823cc0
...
...
@@ -122,8 +122,8 @@ def relative_residual(A, E, B, X, cont_time, trans=False):
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'n,lyap_solver'
,
chain
(
product
(
n_list_small
,
cont_lyap_dense_solver_list
),
product
(
n_list_big
,
cont_lyap_lrcf_solver_list
)))
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_cont_lrcf
(
n
,
m
,
with_E
,
trans
,
lyap_solver
):
if
not
with_E
:
A
=
conv_diff_1d_fd
(
n
,
1
,
0.1
,
cont_time
=
True
)
...
...
@@ -151,11 +151,9 @@ def test_cont_lrcf(n, m, with_E, trans, lyap_solver):
@
pytest
.
mark
.
parametrize
(
'with_E'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'lyap_solver'
,
disc_lyap_dense_solver_list
)
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_disc_lrcf
(
n
,
m
,
with_E
,
trans
,
lyap_solver
):
_check_availability
(
lyap_solver
)
if
not
with_E
:
A
=
conv_diff_1d_fd
(
n
,
1
,
0.1
,
cont_time
=
False
)
E
=
None
...
...
@@ -183,8 +181,8 @@ def test_disc_lrcf(n, m, with_E, trans, lyap_solver):
@
pytest
.
mark
.
parametrize
(
'with_E'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'lyap_solver'
,
cont_lyap_dense_solver_list
)
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_cont_dense
(
n
,
m
,
with_E
,
trans
,
lyap_solver
):
np
.
random
.
seed
(
0
)
A
=
np
.
random
.
randn
(
n
,
n
)
...
...
@@ -204,8 +202,8 @@ def test_cont_dense(n, m, with_E, trans, lyap_solver):
@
pytest
.
mark
.
parametrize
(
'with_E'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'lyap_solver'
,
disc_lyap_dense_solver_list
)
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_disc_dense
(
n
,
m
,
with_E
,
trans
,
lyap_solver
):
np
.
random
.
seed
(
0
)
A
=
np
.
random
.
randn
(
n
,
n
)
...
...
src/pymortests/riccati.py
View file @
db823cc0
...
...
@@ -69,8 +69,8 @@ def relative_residual(A, E, B, C, R, Z, trans):
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'n'
,
n_list_small
)
@
pytest
.
mark
.
parametrize
(
'solver'
,
ricc_dense_solver_list
)
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_ricc_dense
(
n
,
m
,
p
,
with_E
,
with_R
,
trans
,
solver
):
if
not
with_E
:
A
=
conv_diff_1d_fd
(
n
,
1
,
1
)
...
...
@@ -103,8 +103,8 @@ def test_ricc_dense(n, m, p, with_E, with_R, trans, solver):
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'n,solver'
,
chain
(
product
(
n_list_small
,
ricc_lrcf_solver_list_small
),
product
(
n_list_big
,
ricc_lrcf_solver_list_big
)))
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_ricc_lrcf
(
n
,
m
,
p
,
with_E
,
with_R
,
trans
,
solver
):
if
not
with_E
:
A
=
conv_diff_1d_fd
(
n
,
1
,
1
)
...
...
@@ -145,8 +145,8 @@ def test_ricc_lrcf(n, m, p, with_E, with_R, trans, solver):
@
pytest
.
mark
.
parametrize
(
'with_R'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'trans'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'solver'
,
ricc_lrcf_solver_list_small
)
@
skip_if_missing
(
'
slycot
'
)
@
skip_if_missing
(
'
pymess
'
)
@
skip_if_missing
(
'
SLYCOT
'
)
@
skip_if_missing
(
'
PYMESS
'
)
def
test_pos_ricc_lrcf
(
n
,
m
,
p
,
with_E
,
with_R
,
trans
,
solver
):
if
not
with_E
:
A
=
conv_diff_1d_fd
(
n
,
1
,
1
)
...
...
ammservices bridge
@group_958_bot
mentioned in commit
d9e9ee8d
·
Jun 20, 2022
mentioned in commit
d9e9ee8d
mentioned in commit d9e9ee8defa62671e3c57ee3d5d1f1c7c53b15f9
Toggle commit list
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