Skip to content

Commit 6fa42b3

Browse files
authored
Merge pull request #206 from jakevdp/derandomize
Add hypothesis derandomize setting for reproducible builds
2 parents dc3517f + 56eae1e commit 6fa42b3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: conftest.py

+10
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)