Skip to content

Commit

Permalink
Remove trio.tests import causing warnings
Browse files Browse the repository at this point in the history
It is deprecated and the replacement is made private as trio._tests.
While we could be using that, this commit copies over the one relevant
function that is actually necessary. The other two imports just repeat
tests that are already in trio and do not need repeating here.
  • Loading branch information
VincentVanlaer committed Sep 2, 2023
1 parent 02daacb commit 9cda20b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pytest_trio/_tests/test_hypothesis_interaction.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import pytest
import trio
from trio.tests.test_scheduler_determinism import (
scheduler_trace,
test_the_trio_scheduler_is_not_deterministic,
test_the_trio_scheduler_is_deterministic_if_seeded,
)
from hypothesis import given, settings, strategies as st

from pytest_trio.plugin import _trio_test_runner_factory
Expand Down Expand Up @@ -38,6 +33,22 @@ async def test_mark_and_parametrize(x, y):
assert y in (1, 2)


async def scheduler_trace():
"""Returns a scheduler-dependent value we can use to check determinism."""
trace = []

async def tracer(name):
for i in range(10):
trace.append((name, i))
await trio.sleep(0)

async with trio.open_nursery() as nursery:
for i in range(5):
nursery.start_soon(tracer, i)

return tuple(trace)


def test_the_trio_scheduler_is_deterministic_under_hypothesis():
traces = []

Expand Down

0 comments on commit 9cda20b

Please sign in to comment.