From 12a3f3d32b886b9cccd21f321e3029542fa7aeb0fb2c06d41a991792336a4c96 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 22 Jul 2025 02:41:58 +0000 Subject: [PATCH] - Add patch support-new-pytest-asyncio.patch: * Support pytest-asyncio 1.0 changes. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-grpclib?expand=0&rev=5 --- python-grpclib.changes | 6 ++ python-grpclib.spec | 2 + support-new-pytest-asyncio.patch | 101 +++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 support-new-pytest-asyncio.patch diff --git a/python-grpclib.changes b/python-grpclib.changes index f98e34d..f93c9a7 100644 --- a/python-grpclib.changes +++ b/python-grpclib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 22 02:41:10 UTC 2025 - Steve Kowalik + +- Add patch support-new-pytest-asyncio.patch: + * Support pytest-asyncio 1.0 changes. + ------------------------------------------------------------------- Fri May 30 08:00:46 UTC 2025 - John Paul Adrian Glaubitz diff --git a/python-grpclib.spec b/python-grpclib.spec index 7a47137..a634db9 100644 --- a/python-grpclib.spec +++ b/python-grpclib.spec @@ -24,6 +24,8 @@ Summary: Pure-Python gRPC implementation for asyncio License: BSD-3-Clause URL: https://github.com/vmagamedov/grpclib Source: https://github.com/vmagamedov/grpclib/archive/v%{version}.tar.gz#/grpclib-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#vmagamedov/grpclib#205 +Patch0: support-new-pytest-asyncio.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools >= 40.6.0} BuildRequires: %{python_module wheel} diff --git a/support-new-pytest-asyncio.patch b/support-new-pytest-asyncio.patch new file mode 100644 index 0000000..8f45e12 --- /dev/null +++ b/support-new-pytest-asyncio.patch @@ -0,0 +1,101 @@ +From 2008de510c76c40dca9c175febfe14200f1f5fb5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 21 Jun 2025 07:14:42 +0200 +Subject: [PATCH 1/3] 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 +--- + 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') + +From 83497080efb91e24b34e35b6b1f208bee7125d0f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 28 Jun 2025 21:21:44 +0200 +Subject: [PATCH 2/3] Use pytest_asyncio.fixture +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Michał Górny +--- + tests/conftest.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/conftest.py b/tests/conftest.py +index 21159de..e569631 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -1,11 +1,12 @@ + import asyncio + + import pytest ++import pytest_asyncio + + from grpclib.config import Configuration + + +-@pytest.fixture(name='loop') ++@pytest_asyncio.fixture(name='loop') + async def loop_fixture(): + """ Shortcut """ + return asyncio.get_running_loop() + +From 35edfa12d0bb58f5d3cc2e277893b5c33a65eda8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 28 Jun 2025 21:22:16 +0200 +Subject: [PATCH 3/3] Switch to pytest-asyncio strict mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Michał Górny +--- + setup.cfg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.cfg b/setup.cfg +index 06617b9..f54ae6e 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -48,7 +48,7 @@ grpclib = + [tool:pytest] + addopts = -q --tb=native + testpaths = tests +-asyncio_mode = auto ++asyncio_mode = strict + filterwarnings = + error + ignore:.*pkg_resources.*:DeprecationWarning