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)