simvx.graphics.pytest_plugin¶
The GPU gate as a pytest plugin, so every suite in the repository can use it.
The gate’s decision logic lives in :mod:simvx.graphics.gpu_gate; this module is
the thin layer that hangs it on pytest’s hooks. It is here rather than in
packages/graphics/tests/conftest.py because a conftest is scoped to its own
directory tree: with the hooks in there, a vulkan marker meant nothing in the
editor, ide, web or repository-root suites, and --require-gpu was an
unrecognised argument outside the graphics tree. A test that drove a device from
any other suite therefore had to be excluded by node id, which is not a gate: it
is invisible to anyone running that suite locally, which is the case the gate
exists for.
Opt in per suite, by naming this module in a pytest.ini_options addopts
entry, and register the marker beside it::
addopts = ["-p", "simvx.graphics.pytest_plugin"]
markers = ["vulkan: marks tests that require a Vulkan GPU"]
Both halves are needed. strict_markers is on everywhere in this repository,
so a suite that loads the plugin without registering the marker fails on the
first @pytest.mark.vulkan it collects.
Deliberately not a pytest11 entry point. That would auto-load the plugin
in every pytest process in any environment where simvx-graphics is
installed, including the test suite of a game built on the engine, silently
adding an option and a marker nobody asked for. Opting in per suite keeps the
published wheel out of a stranger’s test run.
Module Contents¶
Functions¶
Auto-mark every GPU-fixture test |
|
Central 3-state gate: skip / fail a |
Data¶
API¶
- simvx.graphics.pytest_plugin.__all__¶
[‘pytest_addoption’, ‘pytest_collection_modifyitems’, ‘pytest_runtest_setup’]
- simvx.graphics.pytest_plugin.pytest_addoption(parser: pytest.Parser) None¶
- simvx.graphics.pytest_plugin.pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) None¶
Auto-mark every GPU-fixture test
vulkanso one gate covers all of them.“Requests a GPU fixture” and “is a GPU test” become the same fact, so a new GPU test cannot forget the marker (and
-m vulkan/-m "not vulkan"select correctly). Tests that drive the device without a fixture are caught at runtime by the guard in the graphics suite’spytest_runtest_makereport.The fixtures are the graphics suite’s own, so in every other suite this loop finds nothing and the marker is written by hand.
- simvx.graphics.pytest_plugin.pytest_runtest_setup(item: pytest.Item) None¶
Central 3-state gate: skip / fail a
vulkantest per GPU status + –require-gpu.