diff options
author | Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com> | 2024-05-29 12:13:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-29 12:13:18 (GMT) |
commit | 055c739536ad63b55ad7cd0b91ccacc33064fe11 (patch) | |
tree | 4f5320b354387cc7033816f5133ae9c547f9e767 | |
parent | 0cdc5c8d5446e5eedd34e03d8e380bc237d1379b (diff) | |
download | cpython-055c739536ad63b55ad7cd0b91ccacc33064fe11.zip cpython-055c739536ad63b55ad7cd0b91ccacc33064fe11.tar.gz cpython-055c739536ad63b55ad7cd0b91ccacc33064fe11.tar.bz2 |
CI: set correct working directory for Hypothesis cache (GH-119345)
Set cwd for Hypothesis database
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | Lib/test/support/hypothesis_helper.py | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d14d17a..7e63737 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -388,7 +388,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- @@ -416,7 +416,7 @@ jobs: if: always() with: name: hypothesis-example-db - path: .hypothesis/examples/ + path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/ build_asan: diff --git a/Lib/test/support/hypothesis_helper.py b/Lib/test/support/hypothesis_helper.py index db93eea..40f58a2 100644 --- a/Lib/test/support/hypothesis_helper.py +++ b/Lib/test/support/hypothesis_helper.py @@ -5,6 +5,13 @@ try: 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( |