[3.13] CI: set correct working directory for Hypothesis cache (GH-119345) (#132364)

CI: set correct working directory for Hypothesis cache (GH-119345)

Set cwd for Hypothesis database
(cherry picked from commit 055c739536)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-04-10 16:01:51 +02:00 committed by GitHub
parent c1744902c7
commit ce921075e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -444,7 +444,7 @@ jobs:
id: cache-hypothesis-database
uses: actions/cache@v4
with:
path: ./hypothesis
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
key: hypothesis-database-${{ github.head_ref || github.run_id }}
restore-keys: |
hypothesis-database-
@ -472,7 +472,7 @@ jobs:
if: always()
with:
name: hypothesis-example-db
path: .hypothesis/examples/
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/
build-asan:
name: 'Address sanitizer'

View file

@ -5,6 +5,13 @@
except ImportError:
from . import _hypothesis_stubs as hypothesis
else:
# Regrtest changes to use a tempdir as the working directory, so we have
# to tell Hypothesis to use the original in order to persist the database.
from .os_helper import SAVEDCWD
from hypothesis.configuration import set_hypothesis_home_dir
set_hypothesis_home_dir(os.path.join(SAVEDCWD, ".hypothesis"))
# When using the real Hypothesis, we'll configure it to ignore occasional
# slow tests (avoiding flakiness from random VM slowness in CI).
hypothesis.settings.register_profile(