Skip to content

test(specifiers): stop filtering compatible-release examples by epoch - #1409

Open
cpruijsen wants to merge 1 commit into
pypa:mainfrom
cpruijsen:fix/issue-1406
Open

cpruijsen wants to merge 1 commit into
pypa:mainfrom
cpruijsen:fix/issue-1406

Conversation

@cpruijsen

Copy link
Copy Markdown

Fixes #1406.

TestCompatibleReleaseDefinition.test_compatible_release_matches_expected_compatible sets the independently drawn candidate's epoch to the specifier's with Version.__replace__ instead of assume(spec_ver.epoch == candidate.epoch). Independent draws often differed in epoch, so Hypothesis sometimes filtered 50 examples before accepting 10 and failed HealthCheck.filter_too_much. Same-epoch coverage is kept, and examples are no longer rejected.

Decision

Align epoch on the candidate after generation. Alternatives: generate a shared-epoch pair (open #1407 adds an epoch= argument on pep440_versions plus a pair strategy), drop the epoch constraint, or suppress HealthCheck.filter_too_much. This file already derives related versions with __replace__, and sibling ~= tests already cover mixed-epoch candidates against the expanded form. Suppressing the health check would leave the filtering in place.

Can switch to a composite strategy or to allow mixed epochs.

Test plan

  • Health check still fires on this tree with --hypothesis-seed=198
    before the change
  • Same seed passes after the change
  • python -m pytest -m property tests/property/test_specifier_matching.py

assume() dropped most draws when the specifier and candidate epochs
differed, so Hypothesis intermittently failed HealthCheck.filter_too_much.
@rossburton

Copy link
Copy Markdown

In case a human reviewer doesn't notice, there's also #1407.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent test failures due to hypothesis in TestCompatibleReleaseDefinition.test_compatible_release_matches_expected_compatible

2 participants