Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
Jupyter Docker Stacks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Jupyter Docker Stacks
Commits
74b0a01a
Commit
74b0a01a
authored
Sep 26, 2020
by
Romain
Committed by
GitHub
Sep 26, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1170 from romainx/test_imp
Matplotlib test refactoring (Follow-on PR #1169)
parents
332db3db
e1b97737
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
33 deletions
+16
-33
scipy-notebook/test/test_matplotlib.py
scipy-notebook/test/test_matplotlib.py
+16
-33
No files found.
scipy-notebook/test/test_matplotlib.py
View file @
74b0a01a
...
@@ -9,40 +9,24 @@ import os
...
@@ -9,40 +9,24 @@ import os
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
=
logging
.
getLogger
(
__name__
)
def
test_matplotlib
(
container
):
@
pytest
.
mark
.
parametrize
(
"test_file,expected_file,description"
,
"""Test that matplotlib is able to plot a graph and write it as an image"""
[
host_data_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"data"
)
(
"matplotlib_1.py"
,
"test.png"
,
cont_data_dir
=
"/home/jovyan/data"
"Test that matplotlib is able to plot a graph and write it as an image ..."
),
test_file
=
"matplotlib_1.py"
(
"matplotlib_fonts_1.py"
,
"test_fonts.png"
,
output_dir
=
"/tmp"
"Test cm-super latex labels in matplotlib ..."
)
LOGGER
.
info
(
f
"Test that matplotlib is able to plot a graph and write it as an image ..."
)
])
command
=
"sleep infinity"
def
test_matplotlib
(
container
,
test_file
,
expected_file
,
description
):
running_container
=
container
.
run
(
"""Various tests performed on matplotlib
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
tty
=
True
,
command
=
[
"start.sh"
,
"bash"
,
"-c"
,
command
],
)
command
=
f
"python {cont_data_dir}/{test_file}"
cmd
=
running_container
.
exec_run
(
command
)
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed"
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
# Checking if the file is generated
# https://stackoverflow.com/a/15895594/4413446
expected_file
=
f
"{output_dir}/test.png"
command
=
f
"test -s {expected_file}"
cmd
=
running_container
.
exec_run
(
command
)
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed"
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
def
test_matplotlib_fonts
(
container
):
- Test that matplotlib is able to plot a graph and write it as an image
"""Test matplotlib latex fonts, which depend on the cm-super package"""
- Test matplotlib latex fonts, which depend on the cm-super package
host_data_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"""
"data"
)
host_data_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"data"
)
cont_data_dir
=
"/home/jovyan/data"
cont_data_dir
=
"/home/jovyan/data"
test_file
=
"matplotlib_fonts_1.py"
output_dir
=
"/tmp"
output_dir
=
"/tmp"
LOGGER
.
info
(
f
"Test cm-super latex labels in matplotlib ..."
)
LOGGER
.
info
(
description
)
command
=
"sleep infinity"
command
=
"sleep infinity"
running_container
=
container
.
run
(
running_container
=
container
.
run
(
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
...
@@ -55,8 +39,7 @@ def test_matplotlib_fonts(container):
...
@@ -55,8 +39,7 @@ def test_matplotlib_fonts(container):
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
# Checking if the file is generated
# Checking if the file is generated
# https://stackoverflow.com/a/15895594/4413446
# https://stackoverflow.com/a/15895594/4413446
expected_file
=
f
"{output_dir}/test_fonts.png"
command
=
f
"test -s {output_dir}/{expected_file}"
command
=
f
"test -s {expected_file}"
cmd
=
running_container
.
exec_run
(
command
)
cmd
=
running_container
.
exec_run
(
command
)
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed"
assert
cmd
.
exit_code
==
0
,
f
"Command {command} failed"
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
LOGGER
.
debug
(
cmd
.
output
.
decode
(
"utf-8"
))
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