Skip to content

Commit

Permalink
conftest.py: double Hypothesis deadline (#1252)
Browse files Browse the repository at this point in the history
* conftest.py: double Hypothesis deadline

The deadline is by default 200ms, but this is intended to be useful to
the developer and not necessarily recommended for heavily loaded CI
systems. Avoid warnings by doubling the deadline. If we continue to
see problems, we can revisit disabling (deadline=None) or a longer
deadline.

HypothesisWorks/hypothesis#3713
https://hypothesis.readthedocs.io/en/latest/settings.html#hypothesis.settings.deadline
https://lists.openembedded.org/g/openembedded-core/topic/104640034#196437

Fixes:
"""
Unreliable test timings! On an initial run, this test took 268.29ms,
which exceeded the deadline of 200.00ms, but on a subsequent run it
took 2.63 ms, which did not. If you expect this sort of variability in
your test timings, consider turning deadlines off for this test by
setting deadline=None.
"""

Signed-off-by: Tim Orling <tim.orling@konsulko.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
moto-timo and pre-commit-ci[bot] committed Mar 2, 2024
1 parent 69b6626 commit 3eab45c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: MIT

from datetime import timedelta

import pytest

from hypothesis import HealthCheck, settings
Expand All @@ -20,7 +22,11 @@ def _frozen(request):
def pytest_configure(config):
# HealthCheck.too_slow causes more trouble than good -- especially in CIs.
settings.register_profile(
"patience", settings(suppress_health_check=[HealthCheck.too_slow])
"patience",
settings(
suppress_health_check=[HealthCheck.too_slow],
deadline=timedelta(milliseconds=400),
),
)
settings.load_profile("patience")

Expand Down

0 comments on commit 3eab45c

Please sign in to comment.