Blame SOURCES/9cda20bbb966fe1e4ae51921d566c668654ee5e1.patch

1dc571
From 9cda20bbb966fe1e4ae51921d566c668654ee5e1 Mon Sep 17 00:00:00 2001
1dc571
From: Vincent Vanlaer <vincent.vanlaer@skynet.be>
1dc571
Date: Sun, 3 Sep 2023 00:00:54 +0200
1dc571
Subject: [PATCH] Remove trio.tests import causing warnings
1dc571
1dc571
It is deprecated and the replacement is made private as trio._tests.
1dc571
While we could be using that, this commit copies over the one relevant
1dc571
function that is actually necessary. The other two imports just repeat
1dc571
tests that are already in trio and do not need repeating here.
1dc571
---
1dc571
 .../_tests/test_hypothesis_interaction.py     | 21 ++++++++++++++-----
1dc571
 1 file changed, 16 insertions(+), 5 deletions(-)
1dc571
1dc571
diff --git a/pytest_trio/_tests/test_hypothesis_interaction.py b/pytest_trio/_tests/test_hypothesis_interaction.py
1dc571
index 75aa9f7..cb95a96 100644
1dc571
--- a/pytest_trio/_tests/test_hypothesis_interaction.py
1dc571
+++ b/pytest_trio/_tests/test_hypothesis_interaction.py
1dc571
@@ -1,10 +1,5 @@
1dc571
 import pytest
1dc571
 import trio
1dc571
-from trio.tests.test_scheduler_determinism import (
1dc571
-    scheduler_trace,
1dc571
-    test_the_trio_scheduler_is_not_deterministic,
1dc571
-    test_the_trio_scheduler_is_deterministic_if_seeded,
1dc571
-)
1dc571
 from hypothesis import given, settings, strategies as st
1dc571
 
1dc571
 from pytest_trio.plugin import _trio_test_runner_factory
1dc571
@@ -38,6 +33,22 @@ async def test_mark_and_parametrize(x, y):
1dc571
     assert y in (1, 2)
1dc571
 
1dc571
 
1dc571
+async def scheduler_trace():
1dc571
+    """Returns a scheduler-dependent value we can use to check determinism."""
1dc571
+    trace = []
1dc571
+
1dc571
+    async def tracer(name):
1dc571
+        for i in range(10):
1dc571
+            trace.append((name, i))
1dc571
+            await trio.sleep(0)
1dc571
+
1dc571
+    async with trio.open_nursery() as nursery:
1dc571
+        for i in range(5):
1dc571
+            nursery.start_soon(tracer, i)
1dc571
+
1dc571
+    return tuple(trace)
1dc571
+
1dc571
+
1dc571
 def test_the_trio_scheduler_is_deterministic_under_hypothesis():
1dc571
     traces = []
1dc571