-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-86275: improve Hypothesis configuration for CI and local runs #104468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI on this PR is currently failing to start due to invalid workflow syntax:
https://github.com/python/cpython/actions/runs/4977097067
The workflow is not valid. .github/workflows/build.yml (Line: 378, Col: 11): A sequence was not expected
I have made the requested changes; please review again. |
6476ee0
to
ccbb010
Compare
@@ -374,7 +374,7 @@ jobs: | |||
with: | |||
path: ./hypothesis | |||
key: hypothesis-database-${{ github.head_ref || github.run_id }} | |||
restore-keys: | |||
restore-keys: | | |||
- hypothesis-database- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Zac-HD did you mean to keep that leading hyphen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it look up the '- hypothesis-database-'
prefix, and I'm pretty sure you wanted 'hypothesis-database-'
:
Cache not found for input keys: hypothesis-database-9927179210, - hypothesis-database-
(https://github.com/python/cpython/actions/runs/9927179210/job/27421821417#step:21:24)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #22863 (comment), this PR configures Hypothesis to ignore unexpectedly slow tests. Relative to the default of failing, this reduces flakiness due to variable performance of CI machines.
The second commit adds caching to the CI test run, so that if a CI run finds a rare but real failure that input will be replayed in future CI runs (at least until the cache expires, or the test passes and Hypothesis discards the now-passing input). This doesn't come up often, but if it does will convert flaky tests into reliable failures.
Third, we can upload the database as an "artifact" from CI and configure local runs to use that as a pull-through cache - meaning that "reproducing a failure from CI" is just "run the tests locally". No impact on flakiness but it's a rather nice workflow! 1
cc @pganssle for review / checking that it works on your machine
Footnotes
Unfortunately the 'dump a patch with explicit examples' workflow relies on
libcst
and our pytest plugin - if this would be particularly interesting we can talk about making it work withunittest
and perhaps evenast
. ↩