Skip to content

Run hypothesis strategy tests in CI and stabilize them#307

Open
miketheman wants to merge 2 commits into
mainfrom
claude/enable-strategy-tests-ci-dewliu
Open

Run hypothesis strategy tests in CI and stabilize them#307
miketheman wants to merge 2 commits into
mainfrom
claude/enable-strategy-tests-ci-dewliu

Conversation

@miketheman

Copy link
Copy Markdown
Member

Summary

Addresses the second half of #263: the hypothesis strategy tests are not run in CI.

The CI test step runs:

python -m pytest test_functions.py tests/unit

tests/test_strategies.py lives directly in tests/ (one level above tests/unit/), so it was never collected — the hypothesis version-strategy tests have never actually run in CI.

Simply widening the path isn't enough on its own: those tests are flaky. TestVersionStrategy intermittently trips Hypothesis' HealthCheck.too_slow ("Input generation is slow…") because the version composite is genuinely expensive to generate for large digit counts (the digit-range parameters go up to 100). This is almost certainly why the tests were left out of the CI invocation in the first place.

Changes

  • .github/workflows/test.yml — run pytest test_functions.py tests instead of … tests/unit, so tests/test_strategies.py is collected.
  • tests/test_strategies.py — add @settings(suppress_health_check=[HealthCheck.too_slow]) to the TestVersionStrategy cases, as recommended by Hypothesis' own health-check message, so slow-but-valid input generation doesn't fail the run intermittently.
  • tests/strategies.py — remove the unused line_delimited_data and chunked composites (leftovers from the old streaming-reader linehaul; nothing imports them — only version is used). Isolated in its own commit; drop it if you'd prefer to keep this PR strictly about CI.

Testing

Ran the exact CI command three times to confirm the flakiness is gone:

$ python -m pytest test_functions.py tests
86 passed, 1 skipped   # x3, stable

(The 1 skip is test_download_parsing, which is un-skipped separately in #306.)

Relationship to #306

Independent and non-overlapping. #306 handles the "fixtures inactive" half of #263 (parser + event fixtures); this PR handles the "strategies not run in CI" half (CI config + strategy tests). No shared files, so they can merge in either order. Together they close #263.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 14, 2026 14:31
The CI test step ran `pytest test_functions.py tests/unit`, which never
collected tests/test_strategies.py (it lives in tests/, one level up). As a
result the hypothesis version-strategy tests were never exercised in CI.

Point the test step at `tests` so they run, and suppress
HealthCheck.too_slow on the TestVersionStrategy cases: the `version`
composite is legitimately slow to generate for large digit counts and
otherwise trips Hypothesis' input-generation health check intermittently.

Refs #263

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AQqEBHkvu6QDaidS4zYPVs
line_delimited_data and chunked are leftovers from the old streaming-reader
linehaul; nothing imports them (only `version` is used, by test_strategies.py
and the UA parser tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AQqEBHkvu6QDaidS4zYPVs
@miketheman miketheman added the dev/test Related to development/testing of the project label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev/test Related to development/testing of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test event parsing with fixtures inactive, hypothesis strategies are not run in CI either

2 participants