Hypothesis "DeadlineExceeded" on Slow CI Runners
Hypothesis enforces a per-example deadline (200ms by default) and flags an example that exceeds it as a failure. On a slow or noisy CI runner, a perfectly correct test can blow the deadline purely because of host load.
What this error means
A property-based test fails with hypothesis.errors.DeadlineExceeded: Test took N ms, which exceeds the deadline of 200.00 ms, often intermittently, and passes on a re-run or on a faster machine. The logic is fine; timing tripped the gate.
hypothesis.errors.DeadlineExceeded: Test took 412.55ms, which exceeds the deadline
of 200.00msCommon causes
Slow or contended CI runner
Shared runners run hotter and noisier than a laptop. An example that is fast locally can exceed the 200ms deadline under CI load - a transient, timing-driven failure.
Genuinely slow example
Occasionally an example really is slow (heavy setup, large input). That is a perf signal, not a flake.
How to fix it
Raise or disable the deadline for the test
Set a more forgiving deadline (or None) where CI timing is the issue.
from hypothesis import settings, given
@settings(deadline=None) # or deadline=timedelta(milliseconds=1000)
@given(...)
def test_property(...):
...Set a project-wide CI profile
Register a profile with a relaxed deadline and activate it in CI.
from hypothesis import settings
settings.register_profile("ci", deadline=1000)
# HYPOTHESIS_PROFILE=ci pytestHow to prevent it
- Use a CI Hypothesis profile with a deadline tuned for slow runners.
- Keep example setup cheap so timing stays well under the deadline.
- Reserve
deadline=Nonefor tests where timing is irrelevant.