Skip to content

Commit 055c739

Browse files
authored
CI: set correct working directory for Hypothesis cache (GH-119345)
Set cwd for Hypothesis database
1 parent 0cdc5c8 commit 055c739

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
@@ -388,7 +388,7 @@ jobs:
388388
id: cache-hypothesis-database
389389
uses: actions/cache@v4
390390
with:
391-
path: ./hypothesis
391+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
392392
key: hypothesis-database-${{ github.head_ref || github.run_id }}
393393
restore-keys: |
394394
- hypothesis-database-
@@ -416,7 +416,7 @@ jobs:
416416
if: always()
417417
with:
418418
name: hypothesis-example-db
419-
path: .hypothesis/examples/
419+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/
420420

421421

422422
build_asan:

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)