Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image test using nbval and nbdime #32

Merged
merged 5 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-activate-base: false
channels: conda-forge

- name: Install dependencies
run: mamba install ipython matplotlib flake8

- name: Install package
run: pip install .
- name: Install package with test dependencies
run: pip install .[test]

- name: Test installation
run: python -c 'from matplotlib_inline.backend_inline import show'
run: pytest -v

- name: Test flake8
run: flake8 matplotlib_inline --ignore=E501,W504,W503
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
dist
build
__pycache__
.ipynb_checkpoints
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,30 @@ requires-python = ">=3.8"
[project.entry-points."matplotlib.backend"]
inline = "matplotlib_inline.backend_inline"

[project.optional-dependencies]
test = [
"flake8",
"matplotlib",
"nbdime",
"nbval",
"notebook",
"pytest",
]

[project.urls]
Homepage = "https://github.com/ipython/matplotlib-inline"

[tool.setuptools.dynamic]
version = {attr = "matplotlib_inline.__version__"}

[tool.pytest.ini_options]
xfail_strict = true
log_cli_level = "info"
addopts = [
"--nbval",
"--nbdime",
"--ignore=tests/notebooks/.ipynb_checkpoints/*",
]
testpaths = [
"tests",
]
129 changes: 129 additions & 0 deletions tests/notebooks/mpl_inline.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def test_import():
from matplotlib_inline.backend_inline import show
show()