Skip to content

Use headless viewers in layer and save widget unit tests - #1128

Open
SahilKumar75 wants to merge 2 commits into
neuroinformatics-unit:mainfrom
SahilKumar75:test/headless-layer-styles
Open

SahilKumar75 wants to merge 2 commits into
neuroinformatics-unit:mainfrom
SahilKumar75:test/headless-layer-styles

Conversation

@SahilKumar75

Copy link
Copy Markdown

Description

Move the existing headless napari viewer fixture into the shared fixture module and use it for the layer style tests that only exercise Shapes layer state.

This reduces unnecessary Qt viewer construction while preserving the Qt backed fixture for widget lifecycle and integration coverage.

Motivation and Context

This is the first focused part of issue 1111. The migrated tests only require ViewerModel and do not interact with Qt widgets.

Closes no issue. Progresses #1111.

How Has This Been Tested?

pytest tests/test_unit/test_napari_plugin/test_layer_styles.py
29 passed

pytest tests/test_unit/test_napari_plugin/test_layer_wiring.py::test_frame_slider_range_covers_nan_trimmed_frames tests/test_unit/test_napari_plugin/test_layer_wiring.py::test_frame_slider_range_w_non_movement_layers tests/test_unit/test_napari_plugin/test_layer_wiring.py::test_frame_slider_range_ignores_row_count
5 passed

pre-commit run --files tests/fixtures/napari.py tests/test_unit/test_napari_plugin/test_layer_styles.py tests/test_unit/test_napari_plugin/test_layer_wiring.py
All hooks passed

The complete layer wiring module reaches unchanged Qt viewer tests and then crashes during macOS OpenGL initialization. The migrated headless tests pass independently.

Additional context

The repository does not contain a pull request template. This change follows the contribution guide by keeping the scope focused, linking the issue, and reporting exact validation results.

@SahilKumar75
SahilKumar75 marked this pull request as ready for review September 30, 2026 15:14
@SahilKumar75

Copy link
Copy Markdown
Author

Extended this to eight save widget unit cases and the callback connection test. The save widget still uses real Qt buttons and signals, with qtbot handling cleanup. Only the viewer is headless.

File round trips, save failures and docked widget lifecycle tests still use the full viewer.

All 352 plugin tests passed locally on macOS with napari 0.9.2. Repository hooks passed too. The earlier local OpenGL blocker did not recur in this native Qt run.

@SahilKumar75 SahilKumar75 changed the title Use headless viewer for layer style tests Use headless viewers in layer and save widget unit tests Oct 8, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant