Skip to content

Commit 68a70ee

Browse files
committed
matplotlib pytest working for histogram
1 parent 6009919 commit 68a70ee

File tree

8 files changed

+10
-12
lines changed

8 files changed

+10
-12
lines changed

src/napari_matplotlib/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(self, napari_viewer: napari.viewer.Viewer):
4848

4949
self.viewer = napari_viewer
5050
self.canvas = FigureCanvas()
51+
self.canvas.widget = self
5152

5253
self.canvas.figure.patch.set_facecolor("none")
5354
self.canvas.figure.set_layout_engine("constrained")
Loading

src/napari_matplotlib/tests/conftest.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22
import pytest
3+
from skimage import data
34

45

56
@pytest.fixture(
@@ -11,3 +12,8 @@
1112
)
1213
def image_data(request):
1314
return np.ones(request.param[0]), request.param[1]
15+
16+
17+
@pytest.fixture
18+
def astronaut_data():
19+
return data.astronaut(), {"rgb": True}

src/napari_matplotlib/tests/plotting/__init__.py

Whitespace-only changes.
Binary file not shown.

src/napari_matplotlib/tests/plotting/test_plotting.py

-9
This file was deleted.

src/napari_matplotlib/tests/test_histogram.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55

66
@pytest.mark.mpl_image_compare
7-
def test_example_q_widget(make_napari_viewer, image_data):
7+
def test_example_q_widget(make_napari_viewer, astronaut_data):
88
# Smoke test adding a histogram widget
99
viewer = make_napari_viewer()
10-
viewer.add_image(image_data[0], **image_data[1])
10+
viewer.add_image(astronaut_data[0], **astronaut_data[1])
1111
fig = HistogramWidget(viewer).figure
1212
return fig

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ python =
1111

1212
[testenv]
1313
extras = testing
14-
commands = python -m pytest -v --color=yes --cov=napari_matplotlib --cov-report=xml
14+
commands = python -m pytest --mpl -v --color=yes --cov=napari_matplotlib --cov-report=xml

0 commit comments

Comments
 (0)