commit: 8ecc9e22a1dc32df5b7c14c5e646e6aa0795c77d Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jun 21 05:13:01 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat Jun 21 05:22:00 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ecc9e22
dev-python/grpclib: Fix tests with >=dev-python/pytest-asyncio-1 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../files/grpclib-0.4.8-pytest-asyncio-1.patch | 42 ++++++++++++++++++++++ dev-python/grpclib/grpclib-0.4.8.ebuild | 5 +++ 2 files changed, 47 insertions(+) diff --git a/dev-python/grpclib/files/grpclib-0.4.8-pytest-asyncio-1.patch b/dev-python/grpclib/files/grpclib-0.4.8-pytest-asyncio-1.patch new file mode 100644 index 000000000000..4e5db2479e8e --- /dev/null +++ b/dev-python/grpclib/files/grpclib-0.4.8-pytest-asyncio-1.patch @@ -0,0 +1,42 @@ +From 2008de510c76c40dca9c175febfe14200f1f5fb5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]> +Date: Sat, 21 Jun 2025 07:14:42 +0200 +Subject: [PATCH] Fix tests with pytest-asyncio >= 1.0.0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Update tests not to use the deprecated `event_loop` fixture that's +been removed in pytest-asyncio >= 1.0.0. Instead, use +`asyncio.get_running_loop()` as the recommended replacement. Make +the fixture `async` as well to make things work correctly. + +This change is compatible both with `pytest-asyncio >= 1.0.0` +and `== 0.23.6`. + +Signed-off-by: Michał Górny <[email protected]> +--- + tests/conftest.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 6aef1a1..21159de 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -1,12 +1,14 @@ ++import asyncio ++ + import pytest + + from grpclib.config import Configuration + + + @pytest.fixture(name='loop') +-def loop_fixture(event_loop): ++async def loop_fixture(): + """ Shortcut """ +- return event_loop ++ return asyncio.get_running_loop() + + + @pytest.fixture(name='config') diff --git a/dev-python/grpclib/grpclib-0.4.8.ebuild b/dev-python/grpclib/grpclib-0.4.8.ebuild index 97d78c0eb919..a02b37ec519c 100644 --- a/dev-python/grpclib/grpclib-0.4.8.ebuild +++ b/dev-python/grpclib/grpclib-0.4.8.ebuild @@ -40,3 +40,8 @@ BDEPEND=" " distutils_enable_tests pytest + +PATCHES=( + # https://github.com/vmagamedov/grpclib/pull/205 + "${FILESDIR}/${P}-pytest-asyncio-1.patch" +)
