https://github.com/python/cpython/commit/ce921075e82cb265470b8ce9fef9ff9f75685b86
commit: ce921075e82cb265470b8ce9fef9ff9f75685b86
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: sobolevn <m...@sobolevn.me>
date: 2025-04-10T14:01:51Z
summary:

[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 055c739536ad63b55ad7cd0b91ccacc33064fe11)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.do...@gmail.com>

files:
M .github/workflows/build.yml
M Lib/test/support/hypothesis_helper.py

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c54d94faff2314..1ebea972c263f8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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'
diff --git a/Lib/test/support/hypothesis_helper.py 
b/Lib/test/support/hypothesis_helper.py
index db93eea5e912e0..40f58a2f59c6c3 100644
--- a/Lib/test/support/hypothesis_helper.py
+++ b/Lib/test/support/hypothesis_helper.py
@@ -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(

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to