Skip to content

Register reusable platform and VTK conditional skip markers#296

Open
banesullivan wants to merge 1 commit into
mainfrom
platform-vtk-skip-markers
Open

Register reusable platform and VTK conditional skip markers#296
banesullivan wants to merge 1 commit into
mainfrom
platform-vtk-skip-markers

Conversation

@banesullivan
Copy link
Copy Markdown
Member

@banesullivan banesullivan commented May 18, 2026

Downstream PyVista projects keep reinventing skip_egl, skip_mac, skip_windows, and needs_vtk_version, or fall back to raw skipIf/importorskip that is harder to read and easy to get wrong. This registers all four markers and their pytest_runtest_setup evaluation in the plugin.

needs_vtk_version accepts the positional form (needs_vtk_version(9, 3) meaning at least 9.3) and explicit at_least=/less_than= bounds, pads version tuples so (9, 3) compares correctly against (9, 3, 0), and raises a clear UsageError on a malformed marker. EGL detection falls back to running the test if PyVista's internal gl_checks module is unavailable on an older release.

The markers are opt-in by nature: the hook only acts on tests that carry them.

resolves #275

return uses_egl()


def _needs_vtk_version_skip_reason(item_mark: pytest.Mark) -> str | None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally rather see needs_vtk_version kept inside pyvista, and moved from its test suite into core, maybe _vtk_utilities.

Reason being that I'd like to move pv.vtk_version_info checks from inside filters that require newer VTK versions to use a decorator instead

@_needs_vtk_version(9, 3, 0)
def contour_labels(

So basically it can be used for runtime checks, or adapted for testing.

I made a commit a few days ago to start this but didn't get far pyvista/pyvista#8684

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Platform and VTK Version Skip Markers

2 participants