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
32310893
Unverified
Commit
32310893
authored
Feb 20, 2022
by
Peter Oehme
Committed by
René Fritze
Jun 20, 2022
Browse files
Use pymor.config and pytest.fail
parent
acb25885
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pymortests/base.py
View file @
32310893
...
...
@@ -7,15 +7,15 @@ import os
import
sys
from
pprint
import
pformat
from
functools
import
wraps
import
importlib
import
hypothesis
import
numpy
as
np
from
pickle
import
dump
,
load
from
pkg_resources
import
resource_filename
,
resource_stream
from
pytest
import
skip
from
pytest
import
skip
,
fail
from
pymor.algorithms.basic
import
almost_equal
,
relative_error
from
pymor.core.config
import
config
def
runmodule
(
filename
):
...
...
@@ -97,18 +97,19 @@ def might_exceed_deadline(deadline=-1):
def
skip_if_missing
(
module_name
):
"""Wrapper for requiring certain modules on tests."""
"""Wrapper for requiring certain module
dependencie
s on tests."""
def
_outer_wrapper
(
func
):
@
wraps
(
func
)
def
_inner_wrapper
(
*
args
,
**
kwargs
):
try
:
module
=
importlib
.
import_modul
e
(
module_name
)
config
.
requir
e
(
module_name
)
except
ImportError
as
ie
:
if
not
os
.
environ
.
get
(
'DOCKER_PYMOR'
,
False
):
skip_string
=
'skipped test due to missing
module
'
+
module_name
skip_string
=
'skipped test due to missing
dependency
'
+
module_name
skip
(
skip_string
)
raise
ie
fail_string
=
'failed test due to missing dependency '
+
module_name
fail
(
fail_string
)
func
(
*
args
,
**
kwargs
)
return
_inner_wrapper
return
_outer_wrapper
\ No newline at end of file
return
_outer_wrapper
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