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
0cc1f8dd
Commit
0cc1f8dd
authored
Oct 25, 2020
by
romainx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nbconvert + inkscape test improvements
parent
32768af3
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
254 additions
and
6 deletions
+254
-6
minimal-notebook/test/data/Jupyter_logo.svg
minimal-notebook/test/data/Jupyter_logo.svg
+90
-0
minimal-notebook/test/data/notebook_math.ipynb
minimal-notebook/test/data/notebook_math.ipynb
+0
-0
minimal-notebook/test/data/notebook_svg.ipynb
minimal-notebook/test/data/notebook_svg.ipynb
+138
-0
minimal-notebook/test/test_inkscape.py
minimal-notebook/test/test_inkscape.py
+18
-0
minimal-notebook/test/test_nbconvert.py
minimal-notebook/test/test_nbconvert.py
+8
-6
No files found.
minimal-notebook/test/data/Jupyter_logo.svg
0 → 100644
View file @
0cc1f8dd
This diff is collapsed.
Click to expand it.
minimal-notebook/test/data/notebook
1
.ipynb
→
minimal-notebook/test/data/notebook
_math
.ipynb
View file @
0cc1f8dd
File moved
minimal-notebook/test/data/notebook_svg.ipynb
0 → 100644
View file @
0cc1f8dd
This diff is collapsed.
Click to expand it.
minimal-notebook/test/test_inkscape.py
0 → 100644
View file @
0cc1f8dd
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import
logging
LOGGER
=
logging
.
getLogger
(
__name__
)
def
test_inkscape
(
container
):
"""Inkscape shall be installed to be able to convert SVG files."""
LOGGER
.
info
(
"Test that inkscape is working by printing its version ..."
)
c
=
container
.
run
(
tty
=
True
,
command
=
[
"start.sh"
,
"bash"
,
"-c"
,
"inkscape --version"
]
)
c
.
wait
(
timeout
=
10
)
logs
=
c
.
logs
(
stdout
=
True
)
.
decode
(
"utf-8"
)
LOGGER
.
debug
(
logs
)
assert
"Inkscape"
in
logs
,
"Inkscape not installed or not working"
minimal-notebook/test/test_nbconvert.py
View file @
0cc1f8dd
...
...
@@ -9,15 +9,17 @@ import os
LOGGER
=
logging
.
getLogger
(
__name__
)
@
pytest
.
mark
.
parametrize
(
"format"
,
[
"html"
,
"pdf"
])
def
test_nbconvert
(
container
,
format
):
@
pytest
.
mark
.
parametrize
(
"test_file, output_format,"
,
[
(
"notebook_math"
,
"pdf"
),
(
"notebook_math"
,
"html"
),
(
"notebook_svg"
,
"pdf"
),
(
"notebook_svg"
,
"html"
),
])
def
test_nbconvert
(
container
,
test_file
,
output_format
):
"""Check if nbconvert is able to convert a notebook file"""
host_data_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"data"
)
cont_data_dir
=
"/home/jovyan/data"
test_file
=
"notebook1"
output_dir
=
"/tmp"
LOGGER
.
info
(
f
"Test that
an example notebook can be converted to {
format.upper()} ..."
)
command
=
f
"jupyter nbconvert {cont_data_dir}/{test_file}.ipynb --output-dir {output_dir} --to {format}"
LOGGER
.
info
(
f
"Test that
the example notebook {test_file} can be converted to {output_
format.upper()} ..."
)
command
=
f
"jupyter nbconvert {cont_data_dir}/{test_file}.ipynb --output-dir {output_dir} --to {
output_
format}"
c
=
container
.
run
(
volumes
=
{
host_data_dir
:
{
"bind"
:
cont_data_dir
,
"mode"
:
"ro"
}},
tty
=
True
,
...
...
@@ -27,5 +29,5 @@ def test_nbconvert(container, format):
assert
rv
==
0
or
rv
[
"StatusCode"
]
==
0
,
f
"Command {command} failed"
logs
=
c
.
logs
(
stdout
=
True
)
.
decode
(
"utf-8"
)
LOGGER
.
debug
(
logs
)
expected_file
=
f
"{output_dir}/{test_file}.{format}"
expected_file
=
f
"{output_dir}/{test_file}.{
output_
format}"
assert
expected_file
in
logs
,
f
"Expected file {expected_file} not generated"
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