Skip to content

Commit 9308721

Browse files
committed
Add image test using nbval and nbdime
1 parent 876fe60 commit 9308721

File tree

5 files changed

+168
-11
lines changed

5 files changed

+168
-11
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 11 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
dist
33
build
44
__pycache__
5+
.ipynb_checkpoints

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,30 @@ license = {file = "LICENSE"}
3939
readme = "README.md"
4040
requires-python = ">=3.8"
4141

42+
[project.optional-dependencies]
43+
test = [
44+
"flake8",
45+
"matplotlib",
46+
"nbdime",
47+
"nbval",
48+
"notebook",
49+
"pytest",
50+
]
51+
4252
[project.urls]
4353
Homepage = "https://github.com/ipython/matplotlib-inline"
4454

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

tests/notebooks/mpl_inline.ipynb

Lines changed: 137 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_import.py

Lines changed: 3 additions & 0 deletions
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)