Skip to content

Commit ce92107

Browse files
[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 055c739) Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
1 parent c174490 commit ce92107

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ jobs:
444444
id: cache-hypothesis-database
445445
uses: actions/cache@v4
446446
with:
447-
path: ./hypothesis
447+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
448448
key: hypothesis-database-${{ github.head_ref || github.run_id }}
449449
restore-keys: |
450450
hypothesis-database-
@@ -472,7 +472,7 @@ jobs:
472472
if: always()
473473
with:
474474
name: hypothesis-example-db
475-
path: .hypothesis/examples/
475+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/
476476

477477
build-asan:
478478
name: 'Address sanitizer'

Lib/test/support/hypothesis_helper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
except ImportError:
66
from . import _hypothesis_stubs as hypothesis
77
else:
8+
# Regrtest changes to use a tempdir as the working directory, so we have
9+
# to tell Hypothesis to use the original in order to persist the database.
10+
from .os_helper import SAVEDCWD
11+
from hypothesis.configuration import set_hypothesis_home_dir
12+
13+
set_hypothesis_home_dir(os.path.join(SAVEDCWD, ".hypothesis"))
14+
815
# When using the real Hypothesis, we'll configure it to ignore occasional
916
# slow tests (avoiding flakiness from random VM slowness in CI).
1017
hypothesis.settings.register_profile(

0 commit comments

Comments
 (0)