Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,19 @@ def pytest_pycollect_makeitem_convert_async_functions_to_subclass(
hook_result.force_result(updated_node_collection)


@pytest.hookimpl(trylast=True)
def pytest_collection_modifyitems(items: list[Item]) -> None:
for i, item in enumerate(items):
if (
isinstance(item, Function)
and not isinstance(item, PytestAsyncioFunction)
and item.get_closest_marker("asyncio")
):
specialized_item_class = PytestAsyncioFunction.item_subclass_for(item)
if specialized_item_class:
items[i] = specialized_item_class._from_function(item)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will override items in a way that's breaking and could conflict with, e.g., other pytest plugins.



@contextlib.contextmanager
def _temporary_event_loop_policy(policy: AbstractEventLoopPolicy) -> Iterator[None]:
old_loop_policy = _get_event_loop_policy()
Expand Down
Loading