Skip to content

Fig test slice #113

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

Merged
merged 7 commits into from
May 17, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
report/
.coverage
.coverage.*
.cache
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ docs =
sphinx-gallery
testing =
napari[pyqt6-experimental]
pooch
pyqt6
pytest
pytest-cov
Expand Down
2 changes: 1 addition & 1 deletion src/napari_matplotlib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import napari
from matplotlib.axes import Axes
from matplotlib.backends.backend_qt5agg import (
from matplotlib.backends.backend_qtagg import (
FigureCanvas,
NavigationToolbar2QT,
)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/napari_matplotlib/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ def image_data(request):
@pytest.fixture
def astronaut_data():
return data.astronaut(), {"rgb": True}


@pytest.fixture
def brain_data():
return data.brain(), {"rgb": False}
11 changes: 6 additions & 5 deletions src/napari_matplotlib/tests/test_slice.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import numpy as np
import pytest

from napari_matplotlib import SliceWidget


def test_scatter(make_napari_viewer):
# Smoke test adding a histogram widget
@pytest.mark.mpl_image_compare
def test_slice(make_napari_viewer, brain_data):
viewer = make_napari_viewer()
viewer.add_image(np.random.random((100, 100, 100)))
SliceWidget(viewer)
viewer.add_image(brain_data[0], **brain_data[1])
fig = SliceWidget(viewer).figure
return fig
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ python =

[testenv]
extras = testing
commands = python -m pytest --mpl -v --color=yes --cov=napari_matplotlib --cov-report=xml
commands =
- python -c 'from skimage import data; data.brain()'
- python -m pytest --mpl -v --color=yes --cov=napari_matplotlib --cov-report=xml