#Hypothesis CI seed behavior
1 messages · Page 1 of 1 (latest)
Verify Hypothesis RNG seed
TLDR
Answered: with Hypothesis CI profile / derandomize=True, rerunning the same test at the same commit and environment should use the same seed/examples. Differences can come from explicit seeds, profile/settings, Python/Hypothesis version, example database replay, or nondeterminism in the code/environment.
Hypothesis RNG seed behavior
TLDR
Thread is about how Hypothesis chooses its RNG seed.
The first response confirmed:
- CI runs with
derandomize=True, so Hypothesis seeds from a digest/hash of the test function. - An explicit
@seed(...)orpytest --hypothesis-seedoverrides that. - If neither is set, Hypothesis generates a 128-bit seed from a process-local
random.Random(), which is nondeterministic. - For CI failures, the
@reproduce_failure(...)blob is the reliable rerun target when present.
Current state: seed behavior has been verified; no code change or follow-up action is shown yet.
Tasks:
✅ Verified Hypothesis seed sources and override order
⚙️ None
⏳ None
🚫 None
So when rerunning the same test for the same commit, it should be the same seed, correct ?
Yes, with the important qualifier: if the rerun is using Hypothesis' CI profile / derandomize=True, then the RNG seed is derived from the test function digest, so the same test at the same commit should use the same seed.
Things that can still make it differ: explicit @seed / --hypothesis-seed, a different Hypothesis/Python version, changed settings/profile, the examples database replaying saved failures, or actual nondeterminism in the code under test/environment. So for same commit + same environment + derandomize, expect the same generated examples.