Repository navigation
Test failures when hypothesis is available but cannot reach GitHub #132316
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Apr 9, 2025 - addedinfraCI, GitHub Actions, buildbots, Dependabot, etc.CI, GitHub Actions, buildbots, Dependabot, etc.
on Apr 9, 2025 Thanks for the report! Working on it.
If it's useful, GitHub Actions also sets a
GITHUB_ACTIONSvariable:Always set to
truewhen GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.Docs right now state: https://hypothesis.readthedocs.io/en/latest/reference/api.html#hypothesis.database.GitHubArtifactDatabase
You must provide GITHUB_TOKEN as an environment variable. In CI, Github Actions provides this automatically, but it needs to be set manually for local usage. In a developer machine, this would usually be a Personal Access Token. If the repository is private, it’s necessary for the token to have repo scope in the case of a classic token, or actions:read in the case of a fine-grained token.
We need
GITHUB_TOKENforhypothesisto work properly, otherwise it may fail with:{ "message":"API rate limit exceeded for YOUR_API. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting" }Thanks both for the report and the PR!
Thank you for the fix!
I verified that with this patch all the previously failing tests pass again.
Reacted by Hugo van Kemenade- added a commit that references this issue
on Apr 10, 2025
Bug report
Bug description:
Hi, we recently started seeing several tests (namely
test_binascii,test_math_property,test_toolsandtest_zoneinfo) to fail due to hypothesis warnings (which were recently turned into errors with #131802):or alternatively with
when I restrict the access to the internet.
I see that running with
"CI"set in the environment fixes the issue as the problematic profile withGitHubArtifactDatabaseis not registered, but that seems more like a lucky workaround.I am not sure about the solution - maybe it can check whether
"GITHUB_TOKEN"is also available? Or maybe the warning should be ignored and not cause the tests to fail.I also think it should honor
-urlfetchand-networkoptions.CPython versions tested on:
3.13
Operating systems tested on:
Other
Linked PRs
socketandGITHUB_TOKENenv to useGitHubArtifactDatabase#132348socketandGITHUB_TOKENenv to useGitHubArtifactDatabase(GH-132348) #132367