From b65a1732effc6c3edda50ecc963ad715dd1b8d56 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Sun, 16 Jan 2022 21:03:32 -0500 Subject: [PATCH] Remove unconditional test item attribute access --- pytest_asyncio/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 7a7c8dd5..0448e03b 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -447,7 +447,7 @@ def pytest_runtest_setup(item: pytest.Item) -> None: if "event_loop" in fixturenames: fixturenames.remove("event_loop") fixturenames.insert(0, "event_loop") - obj = item.obj # type: ignore[attr-defined] + obj = getattr(item, 'obj', None) if ( item.get_closest_marker("asyncio") is not None and not getattr(obj, "hypothesis", False)