Repository navigation
Prevent tests IDs from drifting between pytest discovery and running - #3520
Merged
Merged
Conversation
Replace random test inputs with deterministic fixtures and stable pytest ids across the pose-estimation PyTorch tests. This avoids run-after-discovery desync, which makes the tests impossible to run in e.g. the VSCode pytest extension
Assign per-case RNG seeds to the PyTorch pose estimation tests and replace a few random samples with fixed edge-case parameters. This keeps test IDs stable while covering a wider range of augmentation, batch size, and input-size combinations.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The resize test config contains a misspelled option key (keep_ration) that is ignored by the implementation, reducing test correctness.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR makes several PyTorch pose-estimation tests deterministic and selectable by stable pytest IDs, addressing mismatches between pytest discovery and ID-based runs (e.g., IDE test panels).
Changes:
- Replace Python
randomusage in parametrized tests with per-casenumpy.random.default_rng(seed)for reproducible inputs. - Introduce explicit, stable
pytest.param(..., id=...)cases for backbones/heads/transforms and dataset augmentation scenarios. - Expand deterministic coverage by pinning previously-random edge cases (e.g., extreme augmentation / size combinations).
File summaries
| File | Description |
|---|---|
| tests/pose_estimation_pytorch/other/test_pose_model.py | Adds stable IDs for backbone/head parametrizations and uses seeded NumPy RNG to generate deterministic input sizes. |
| tests/pose_estimation_pytorch/other/test_dataset.py | Removes random parametrization, replacing it with fixed, named cases to stabilize dataset iteration tests. |
| tests/pose_estimation_pytorch/other/test_api_utils.py | Refactors transform test cases into named configs with deterministic RNG-driven synthetic inputs and clearer exception assertions. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
deruyter92
approved these changes
Oct 22, 2026
deruyter92
left a comment
Collaborator
There was a problem hiding this comment.
Very useful!
One minor comment, otherwise LGTM!
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.
Replaces the use of Python's
randommodule with NumPy's random number generator seeded per test case, ensures stable test parametrization and ID generation, and clarifies test case identifiers.Goal