Skip tests based on hardware availability. Also skips timing_serial tests unless explicitly selected with -m.
(
config: pytest.Config, items: List[pytest.Item]
)
| 47 | |
| 48 | |
| 49 | def pytest_collection_modifyitems( |
| 50 | config: pytest.Config, items: List[pytest.Item] |
| 51 | ) -> None: |
| 52 | """Skip tests based on hardware availability. |
| 53 | |
| 54 | Also skips timing_serial tests unless explicitly selected with -m. |
| 55 | """ |
| 56 | sm_version = _gpu_sm_version() |
| 57 | skip_timing = pytest.mark.skip( |
| 58 | reason="timing_serial tests skipped by default; run with: pytest tests -m timing_serial -n 0" |
| 59 | ) |
| 60 | |
| 61 | # If the user passed -m that includes timing_serial, don't auto-skip them. |
| 62 | markexpr = config.getoption("-m", default="") |
| 63 | timing_selected = "timing_serial" in markexpr |
| 64 | |
| 65 | for item in items: |
| 66 | if sm_version < 100 and any(item.iter_markers(name="requires_cutile")): |
| 67 | item.add_marker( |
| 68 | pytest.mark.skip( |
| 69 | reason=f"cuTile requires sm_100+ (detected sm_{sm_version})" |
| 70 | ) |
| 71 | ) |
| 72 | if "timing_serial" in item.keywords and not timing_selected: |
| 73 | item.add_marker(skip_timing) |
| 74 | |
| 75 | |
| 76 | @pytest.fixture |
nothing calls this directly
no test coverage detected