Skip to content

test: avoid filtering compatible release examples - #1407

Open
LouisDeconinck wants to merge 1 commit into
pypa:mainfrom
LouisDeconinck:fix/hypothesis-compatible-release-epochs
Open

LouisDeconinck wants to merge 1 commit into
pypa:mainfrom
LouisDeconinck:fix/hypothesis-compatible-release-epochs

Conversation

@LouisDeconinck

Copy link
Copy Markdown

Fixes #1406.

The compatible-release property test discarded candidates with a different epoch via assume. Because the generated versions often had different epochs, Hypothesis could intermittently fail its filtering health check.

Generate the specifier and candidate with the same epoch instead. This preserves coverage of epoch-bearing versions while removing the rejection that caused intermittent failures.

Checks:

  • PYTHONPATH=src uv run --no-project --with hypothesis>=6 --with pytest>=8 python -m pytest -q -m property tests/property/test_specifier_matching.py — 55 passed
  • prek run ruff-check ruff-format mypy --all-files — passed
  • uvx --from build pyproject-build and uvx twine check --strict — passed
  • git diff --check — passed
  • uvx nox -s lint — code hooks passed; aggregate session is blocked by five pre-existing Zizmor ref-version-mismatch findings in unrelated workflow files

Assisted by Codex via the commit trailer.

Signed-off-by: Louis Deconinck <louis.dck@gmail.com>
Assisted-by: Codex
@rossburton

Copy link
Copy Markdown

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

@LouisDeconinck

Copy link
Copy Markdown
Author

Thanks @rossburton — I hadn't spotted #1409.

For reviewers comparing the two: this PR removes the assume() by drawing both versions from one epoch at the strategy level (compatible_release_version_pairs passes a shared epoch= into pep440_versions), while #1409 keeps independent draws and aligns the candidate's epoch afterwards via Version.__replace__. Both keep same-epoch coverage without filtering; #1409 is the smaller diff, this one makes the shared-epoch intent explicit in the strategy and avoids mutating the generated candidate.

Happy either way — if #1409 lands first I'm fine closing this.

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