Skip to content

Commit

Permalink
TEMP: ignore Flaky crosshair errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jul 7, 2024
1 parent 026694f commit b2d11c7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions hypothesis-python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import pytest

from hypothesis._settings import is_in_ci
from hypothesis.errors import NonInteractiveExampleWarning
from hypothesis._settings import is_in_ci, settings
from hypothesis.errors import Flaky, NonInteractiveExampleWarning
from hypothesis.internal.compat import add_note
from hypothesis.internal.conjecture import junkdrawer
from hypothesis.internal.detection import is_hypothesis_test
Expand Down Expand Up @@ -137,7 +137,13 @@ def pytest_runtest_call(item):
# This hookwrapper checks for PRNG state leaks from Hypothesis tests.
# See: https://github.com/HypothesisWorks/hypothesis/issues/1919
if not (hasattr(item, "obj") and is_hypothesis_test(item.obj)):
outcome = yield
try:
outcome = yield
except Flaky:
current_backend = settings.get_profile(settings._current_profile).backend
if current_backend == "crosshair":
pytest.xfail(reason="yeah, we know about this annoying issue")
raise
elif "pytest_randomly" in sys.modules:
# See https://github.com/HypothesisWorks/hypothesis/issues/3041 - this
# branch exists to make it easier on external contributors, but should
Expand All @@ -150,7 +156,13 @@ def pytest_runtest_call(item):
# state_before, and that just shows as "no use of random".
random.seed(independent_random.randrange(2**32))
before = random.getstate()
outcome = yield
try:
outcome = yield
except Flaky:
current_backend = settings.get_profile(settings._current_profile).backend
if current_backend == "crosshair":
pytest.xfail(reason="yeah, we know about this annoying issue")
raise
after = random.getstate()
if before != after:
if after in random_states_after_tests:
Expand Down

0 comments on commit b2d11c7

Please sign in to comment.