|
7 | 7 |
|
8 | 8 | import pytest |
9 | 9 |
|
| 10 | +from ndev_workflows.widgets._workflow_inspector import ( |
| 11 | + HAS_MATPLOTLIB, |
| 12 | + WorkflowInspector, |
| 13 | +) |
| 14 | + |
10 | 15 |
|
11 | 16 | class TestWorkflowInspector: |
12 | 17 | """Core WorkflowInspector widget tests.""" |
13 | 18 |
|
14 | 19 | @pytest.fixture |
15 | 20 | def inspector(self, make_napari_viewer, qtbot): |
16 | 21 | """Create a WorkflowInspector widget.""" |
17 | | - pytest.importorskip('matplotlib') |
18 | | - pytest.importorskip('networkx') |
19 | | - |
20 | | - from ndev_workflows.widgets._workflow_inspector import ( |
21 | | - WorkflowInspector, |
22 | | - ) |
23 | | - |
24 | 22 | viewer = make_napari_viewer() |
25 | 23 | widget = WorkflowInspector(viewer) |
26 | 24 | qtbot.addWidget(widget) |
@@ -96,6 +94,7 @@ def identity(x): |
96 | 94 | assert inspector._use_live_mode is True |
97 | 95 | assert inspector._loaded_workflow is None |
98 | 96 |
|
| 97 | + @pytest.mark.skipif(not HAS_MATPLOTLIB, reason='requires matplotlib') |
99 | 98 | def test_graph_updates_on_workflow_load(self, inspector, tmp_path): |
100 | 99 | """Test that graph is drawn when workflow is loaded.""" |
101 | 100 | from ndev_workflows import Workflow, save_workflow |
@@ -210,13 +209,13 @@ def test_pending_updates_property(self, make_napari_viewer): |
210 | 209 | assert 'modified' not in manager.pending_updates |
211 | 210 |
|
212 | 211 |
|
| 212 | +@pytest.mark.skipif(not HAS_MATPLOTLIB, reason='requires matplotlib') |
213 | 213 | class TestDraggableNodes: |
214 | | - """Test DraggableNodes interaction handling.""" |
| 214 | + """Test DraggableNodes interaction handling (requires matplotlib).""" |
215 | 215 |
|
216 | 216 | @pytest.fixture |
217 | 217 | def draggable_nodes(self): |
218 | 218 | """Create DraggableNodes with real MplCanvas.""" |
219 | | - pytest.importorskip('matplotlib') |
220 | 219 | from unittest.mock import MagicMock |
221 | 220 |
|
222 | 221 | from ndev_workflows.widgets._workflow_inspector import ( |
@@ -272,7 +271,6 @@ def test_update_node_status_changes_color(self, draggable_nodes): |
272 | 271 |
|
273 | 272 | def test_select_node_with_viewer(self, make_napari_viewer): |
274 | 273 | """Test clicking a node selects the layer in viewer.""" |
275 | | - pytest.importorskip('matplotlib') |
276 | 274 | import numpy as np |
277 | 275 |
|
278 | 276 | from ndev_workflows.widgets._workflow_inspector import ( |
|
0 commit comments