Skip to content

Add hypothesis derandomize setting for reproducible builds #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def pytest_addoption(parser):
action="store_true",
help="disable the Hypothesis deadline",
)
# Hypothesis derandomize
parser.addoption(
"--hypothesis-derandomize",
"--derandomize",
action="store_true",
help="set the Hypothesis derandomize parameter",
)
# disable extensions
parser.addoption(
"--disable-extension",
Expand Down Expand Up @@ -79,11 +86,14 @@ def pytest_configure(config):
# Hypothesis
hypothesis_max_examples = config.getoption("--hypothesis-max-examples")
disable_deadline = config.getoption("--hypothesis-disable-deadline")
derandomize = config.getoption("--hypothesis-derandomize")
profile_settings = {}
if hypothesis_max_examples is not None:
profile_settings["max_examples"] = int(hypothesis_max_examples)
if disable_deadline:
profile_settings["deadline"] = None
if derandomize:
profile_settings["derandomize"] = True
if profile_settings:
settings.register_profile("xp_override", **profile_settings)
settings.load_profile("xp_override")
Expand Down