Skip to content

Commit 88eea86

Browse files
jakevdphonno
authored andcommitted
Add hypothesis derandomize setting for reproducible builds
1 parent dc3517f commit 88eea86

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/numpy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
env:
2929
ARRAY_API_TESTS_MODULE: numpy.array_api
3030
run: |
31-
pytest -v -rxXfE --ci --skips-file numpy-skips.txt
31+
pytest -v -rxXfE --ci --skips-file numpy-skips.txt --derandomize

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ def pytest_addoption(parser):
3131
action="store_true",
3232
help="disable the Hypothesis deadline",
3333
)
34+
# Hypothesis derandomize
35+
parser.addoption(
36+
"--hypothesis-derandomize",
37+
"--derandomize",
38+
action="store_true",
39+
help="set the Hypothesis derandomize parameter",
40+
)
3441
# disable extensions
3542
parser.addoption(
3643
"--disable-extension",
@@ -79,11 +86,14 @@ def pytest_configure(config):
7986
# Hypothesis
8087
hypothesis_max_examples = config.getoption("--hypothesis-max-examples")
8188
disable_deadline = config.getoption("--hypothesis-disable-deadline")
89+
derandomize = config.getoption("--hypothesis-derandomize")
8290
profile_settings = {}
8391
if hypothesis_max_examples is not None:
8492
profile_settings["max_examples"] = int(hypothesis_max_examples)
8593
if disable_deadline:
8694
profile_settings["deadline"] = None
95+
if derandomize:
96+
profile_settings["derandomize"] = True
8797
if profile_settings:
8898
settings.register_profile("xp_override", **profile_settings)
8999
settings.load_profile("xp_override")

0 commit comments

Comments
 (0)