commit:     4cb1caac74009d583c93c638bd3f61dc6cb25a3f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  3 15:09:13 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb  3 15:09:49 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cb1caac

dev-python/pytest-trio: Backport a test fix for newer trio

Closes: https://bugs.gentoo.org/923163
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../pytest-trio/files/pytest-trio-0.8.0-test.patch | 52 ++++++++++++++++++++++
 ...io-0.8.0.ebuild => pytest-trio-0.8.0-r1.ebuild} |  7 ++-
 2 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/dev-python/pytest-trio/files/pytest-trio-0.8.0-test.patch 
b/dev-python/pytest-trio/files/pytest-trio-0.8.0-test.patch
new file mode 100644
index 000000000000..a65fd2aee071
--- /dev/null
+++ b/dev-python/pytest-trio/files/pytest-trio-0.8.0-test.patch
@@ -0,0 +1,52 @@
+From 9cda20bbb966fe1e4ae51921d566c668654ee5e1 Mon Sep 17 00:00:00 2001
+From: Vincent Vanlaer <vincent.vanl...@skynet.be>
+Date: Sun, 3 Sep 2023 00:00:54 +0200
+Subject: [PATCH 1/2] Remove trio.tests import causing warnings
+
+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.
+---
+ .../_tests/test_hypothesis_interaction.py     | 21 ++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/pytest_trio/_tests/test_hypothesis_interaction.py 
b/pytest_trio/_tests/test_hypothesis_interaction.py
+index 75aa9f7..cb95a96 100644
+--- a/pytest_trio/_tests/test_hypothesis_interaction.py
++++ b/pytest_trio/_tests/test_hypothesis_interaction.py
+@@ -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
+@@ -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 = []
+ 
+

diff --git a/dev-python/pytest-trio/pytest-trio-0.8.0.ebuild 
b/dev-python/pytest-trio/pytest-trio-0.8.0-r1.ebuild
similarity index 89%
rename from dev-python/pytest-trio/pytest-trio-0.8.0.ebuild
rename to dev-python/pytest-trio/pytest-trio-0.8.0-r1.ebuild
index 4159233367eb..a73c87ac4e00 100644
--- a/dev-python/pytest-trio/pytest-trio-0.8.0.ebuild
+++ b/dev-python/pytest-trio/pytest-trio-0.8.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -37,6 +37,11 @@ distutils_enable_sphinx docs/source \
        dev-python/sphinxcontrib-trio
 
 python_prepare_all() {
+       local PATCHES=(
+               # https://github.com/python-trio/pytest-trio/pull/135
+               "${FILESDIR}/${P}-test.patch"
+       )
+
        # Defining 'pytest_plugins' in a non-top-level conftest is no longer 
supported:
        mv pytest_trio/_tests/conftest.py conftest.py || die
        distutils-r1_python_prepare_all

Reply via email to