Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
lbmpy
Commits
d4ac8672
Commit
d4ac8672
authored
5 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
tests: suppress warnings from jupyter notebook runner
parent
ab9e5e47
Branches
function-call-printing
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#20268
passed
5 years ago
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
conftest.py
+8
-4
8 additions, 4 deletions
conftest.py
pytest.ini
+4
-0
4 additions, 0 deletions
pytest.ini
with
12 additions
and
4 deletions
conftest.py
+
8
−
4
View file @
d4ac8672
...
@@ -3,6 +3,7 @@ import pytest
...
@@ -3,6 +3,7 @@ import pytest
import
tempfile
import
tempfile
import
runpy
import
runpy
import
sys
import
sys
import
warnings
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# at the same time
# at the same time
from
pystencils.cpu
import
cpujit
from
pystencils.cpu
import
cpujit
...
@@ -89,7 +90,7 @@ class IPyNbTest(pytest.Item):
...
@@ -89,7 +90,7 @@ class IPyNbTest(pytest.Item):
# in notebooks there is an implicit plt.show() - if this is not called a warning is shown when the next
# in notebooks there is an implicit plt.show() - if this is not called a warning is shown when the next
# plot is created. This warning is suppressed here
# plot is created. This warning is suppressed here
exec
(
"
import warnings;
"
exec
(
"
import warnings;
"
"
warnings.filterwarnings(
'
ignore
'
,
'
Adding an axes using the same arguments as a previous.*
'
)
"
,
"
warnings.filterwarnings(
'
ignore
'
,
'
Adding an axes using the same arguments as a previous.*
'
)
;
"
,
global_dict
)
global_dict
)
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
f
.
write
(
self
.
code
.
encode
())
f
.
write
(
self
.
code
.
encode
())
...
@@ -104,9 +105,12 @@ class IPyNbFile(pytest.File):
...
@@ -104,9 +105,12 @@ class IPyNbFile(pytest.File):
exporter
.
exclude_input_prompt
=
True
exporter
.
exclude_input_prompt
=
True
notebook_contents
=
self
.
fspath
.
open
()
notebook_contents
=
self
.
fspath
.
open
()
notebook
=
nbformat
.
read
(
notebook_contents
,
4
)
code
,
_
=
exporter
.
from_notebook_node
(
notebook
)
with
warnings
.
catch_warnings
():
yield
IPyNbTest
(
self
.
name
,
self
,
code
)
warnings
.
filterwarnings
(
"
ignore
"
,
"
IPython.core.inputsplitter is deprecated
"
)
notebook
=
nbformat
.
read
(
notebook_contents
,
4
)
code
,
_
=
exporter
.
from_notebook_node
(
notebook
)
yield
IPyNbTest
(
self
.
name
,
self
,
code
)
def
teardown
(
self
):
def
teardown
(
self
):
pass
pass
...
...
This diff is collapsed.
Click to expand it.
pytest.ini
+
4
−
0
View file @
d4ac8672
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
python_files
=
test_*.py *_test.py scenario_*.py
python_files
=
test_*.py *_test.py scenario_*.py
norecursedirs
=
*.egg-info .git .cache .ipynb_checkpoints htmlcov
norecursedirs
=
*.egg-info .git .cache .ipynb_checkpoints htmlcov
addopts
=
--doctest-modules --durations=20 --cov-config pytest.ini
addopts
=
--doctest-modules --durations=20 --cov-config pytest.ini
markers
=
longrun:
tests
only
run
at
night
since
they
have
large
execution
time
notebook:
jupyter
notebooks
[run]
[run]
branch
=
True
branch
=
True
...
...
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