Skip to content

Commit 2de2053

Browse files
committed
Update support/hypothesis_helper.py from 3.13.7
1 parent 933db10 commit 2de2053

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Lib/test/support/hypothesis_helper.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
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 test.support import has_socket_support
11+
from test.support.os_helper import SAVEDCWD
12+
from hypothesis.configuration import set_hypothesis_home_dir
13+
14+
set_hypothesis_home_dir(os.path.join(SAVEDCWD, ".hypothesis"))
15+
816
# When using the real Hypothesis, we'll configure it to ignore occasional
917
# slow tests (avoiding flakiness from random VM slowness in CI).
1018
hypothesis.settings.register_profile(
@@ -21,7 +29,14 @@
2129
# of failing examples, and also use a pull-through cache to automatically
2230
# replay any failing examples discovered in CI. For details on how this
2331
# works, see https://hypothesis.readthedocs.io/en/latest/database.html
24-
if "CI" not in os.environ:
32+
# We only do that if a GITHUB_TOKEN env var is provided, see:
33+
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
34+
# And Python is built with socket support:
35+
if (
36+
has_socket_support
37+
and "CI" not in os.environ
38+
and "GITHUB_TOKEN" in os.environ
39+
):
2540
from hypothesis.database import (
2641
GitHubArtifactDatabase,
2742
MultiplexedDatabase,

0 commit comments

Comments
 (0)