]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] CI: set correct working directory for Hypothesis cache (GH-119345) (#132364)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 10 Apr 2025 14:01:51 +0000 (16:01 +0200)
committerGitHub <noreply@github.com>
Thu, 10 Apr 2025 14:01:51 +0000 (14:01 +0000)
CI: set correct working directory for Hypothesis cache (GH-119345)

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

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
.github/workflows/build.yml
Lib/test/support/hypothesis_helper.py

index c54d94faff2314b201daa27738c743dac9fb0d7b..1ebea972c263f8e5a55f7e2c9600ca676e726704 100644 (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'
index db93eea5e912e03de0d2ec63dde3b38800c68c6a..40f58a2f59c6c3a9d1bd60917ed738bd3b5e01d2 100644 (file)
@@ -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(