Repository navigation
test(conftest): skip GPU tests by marker, never by keyword - #50
Merged
Merged
Conversation
tests/conftest.py skipped any test whose keywords held "gpu" when no GPU was present. A test's keywords are its marker names, but also its parametrize id, its function and parent names and its function attributes, so an unmarked test parametrized with the value "gpu" was skipped on CPU without carrying any marker. The root conftest already skips tests marked gpu or cuda through get_closest_marker, so the hook and the --device option it read are removed; nothing passed --device. A pytester test runs the suite's tests/conftest.py on an unmarked test whose parametrize id is gpu and asserts it runs; it was skipped before the change. The teardown test drops the ids it used to avoid the same skip.
…kes redundant tests/conftest.py registered the integration, e2e, benchmark, gpu and slow markers, all of which pyproject.toml already registers for --strict-markers, and added an --integration option that nothing reads. The suite's markers now have one registration, in pyproject.toml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/conftest.pyskipped any test whose keywords held"gpu"when no GPU was present. A test's keywords hold its markers, and also its parametrize id, its function and parent names and its function attributes, so an unmarked test parametrized with the value"gpu"was skipped on CPU. The root conftest already skips tests markedgpuorcudathroughget_closest_marker.Two commits: the keyword skip and
--device(test-first), then the redundant marker registrations and the unread--integrationoption.Evidence
tests/conftest.pythrough pytester on an unmarked test parametrized with"gpu":{'skipped': 1} != {'skipped': 0}, 1 failed.After: 4 passed (the new test and the teardown test, now under its plain
gpu/cudaids).--strict-markers --strict-config(19 tests); the 11 root-level test files pass (257); pre-commit passes on all files.--deviceor read--integration(searched across the repository, CI and docs).Merge Danger
Door: two-way
Blast Radius: test collection
CI selects tests by marker expression (
ci.ymlCI_PYTEST_MARKERS), which this does not touch.