python3-pytest-mock: Fix asyncio tests with pytest 8.4+

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2025-07-26 16:10:47 -07:00
parent 209b5ed94d
commit 5b2a5bf259
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
From 17850cde66d52a851a8a15a61f5c97311d30a296 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 26 Jul 2025 16:03:03 -0700
Subject: [PATCH] Add asyncio fixture to test_instance_async_method_spy
This ensures that this test executes and passes
with pytest-8.4+
pytest now throws errors for such functions [1]
which were skipped in older versions
[1] https://github.com/pytest-dev/pytest/issues/11372
Upstream-Status: Submitted [https://github.com/pytest-dev/pytest-mock/pull/516]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
tests/test_pytest_mock.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py
index 1a51636..b158d97 100644
--- a/tests/test_pytest_mock.py
+++ b/tests/test_pytest_mock.py
@@ -523,7 +523,7 @@ def test_callable_like_spy(testdir: Any, mocker: MockerFixture) -> None:
assert spy.spy_return == 20
assert spy.spy_return_list == [20]
-
+@pytest.mark.asyncio
async def test_instance_async_method_spy(mocker: MockerFixture) -> None:
class Foo:
async def bar(self, arg):