Skip to content

Commit 9a038b7

Browse files
ianthomas23martinRenou
authored andcommitted
Add image test using nbval and nbdime
1 parent fc7dd9d commit 9a038b7

File tree

5 files changed

+168
-11
lines changed

5 files changed

+168
-11
lines changed

.github/workflows/main.yml

+5-11
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,16 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v2
2828

29-
- name: Setup conda
30-
uses: conda-incubator/setup-miniconda@v2
29+
- name: Setup Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v4
3131
with:
3232
python-version: ${{ matrix.python-version }}
33-
mamba-version: "*"
34-
auto-activate-base: false
35-
channels: conda-forge
3633

37-
- name: Install dependencies
38-
run: mamba install ipython matplotlib flake8
39-
40-
- name: Install package
41-
run: pip install .
34+
- name: Install package with test dependencies
35+
run: pip install .[test]
4236

4337
- name: Test installation
44-
run: python -c 'from matplotlib_inline.backend_inline import show'
38+
run: pytest -v
4539

4640
- name: Test flake8
4741
run: flake8 matplotlib_inline --ignore=E501,W504,W503

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
dist
33
build
44
__pycache__
5+
.ipynb_checkpoints

pyproject.toml

+22
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,30 @@ requires-python = ">=3.8"
4242
[project.entry-points."matplotlib.backend"]
4343
inline = "matplotlib_inline.backend_inline"
4444

45+
[project.optional-dependencies]
46+
test = [
47+
"flake8",
48+
"matplotlib",
49+
"nbdime",
50+
"nbval",
51+
"notebook",
52+
"pytest",
53+
]
54+
4555
[project.urls]
4656
Homepage = "https://github.com/ipython/matplotlib-inline"
4757

4858
[tool.setuptools.dynamic]
4959
version = {attr = "matplotlib_inline.__version__"}
60+
61+
[tool.pytest.ini_options]
62+
xfail_strict = true
63+
log_cli_level = "info"
64+
addopts = [
65+
"--nbval",
66+
"--nbdime",
67+
"--ignore=tests/notebooks/.ipynb_checkpoints/*",
68+
]
69+
testpaths = [
70+
"tests",
71+
]

tests/notebooks/mpl_inline.ipynb

+137
Large diffs are not rendered by default.

tests/test_import.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def test_import():
2+
from matplotlib_inline.backend_inline import show
3+
show()

0 commit comments

Comments
 (0)