conftest.py: double Hypothesis deadline (#1252)

* 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.

https://github.com/HypothesisWorks/hypothesis/issues/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>
This commit is contained in:
Tim Orling 2024-03-01 22:20:56 -08:00 committed by GitHub
parent 69b6626046
commit 3eab45c5d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,7 @@
# SPDX-License-Identifier: MIT
from datetime import timedelta
import pytest
from hypothesis import HealthCheck, settings
@ -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")