From: Zac Hatfield-Dodds Date: Wed, 29 May 2024 12:13:18 +0000 (-0700) Subject: CI: set correct working directory for Hypothesis cache (GH-119345) X-Git-Tag: v3.14.0a1~1719 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=055c739536ad63b55ad7cd0b91ccacc33064fe11;p=thirdparty%2FPython%2Fcpython.git CI: set correct working directory for Hypothesis cache (GH-119345) Set cwd for Hypothesis database --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d14d17a5e088..7e63737b90b7 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 db93eea5e912..40f58a2f59c6 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(