@@ -323,31 +323,27 @@ async def test_anything():
323323 )
324324
325325
326- def test_nested_conftest_hook_implementations_respect_hook_order (
326+ def test_nested_conftest_hook_respects_conftest_locality (
327327 pytester : Pytester ,
328328) -> None :
329329 pytester .makeini ("[pytest]\n asyncio_default_fixture_loop_scope = function" )
330330 pytester .makeconftest (dedent ("""\
331331 import asyncio
332- import pytest
333332
334333 class RootCustomEventLoop(asyncio.SelectorEventLoop):
335334 pass
336335
337- @pytest.hookimpl(trylast=True)
338336 def pytest_asyncio_loop_factories(config, item):
339337 return {"root": RootCustomEventLoop}
340338 """ ))
341- subdir = pytester .mkdir ("subtests " )
339+ subdir = pytester .mkdir ("subdir " )
342340 subdir .joinpath ("conftest.py" ).write_text (
343341 dedent ("""\
344342 import asyncio
345- import pytest
346343
347344 class SubCustomEventLoop(asyncio.SelectorEventLoop):
348345 pass
349346
350- @pytest.hookimpl(tryfirst=True)
351347 def pytest_asyncio_loop_factories(config, item):
352348 return {"sub": SubCustomEventLoop}
353349 """ ),
@@ -360,8 +356,10 @@ def pytest_asyncio_loop_factories(config, item):
360356 pytest_plugins = "pytest_asyncio"
361357
362358 @pytest.mark.asyncio
363- async def test_uses_sub_loop():
364- assert type(asyncio.get_running_loop()).__name__ == "SubCustomEventLoop"
359+ async def test_root_uses_root_loop():
360+ assert (
361+ type(asyncio.get_running_loop()).__name__ == "RootCustomEventLoop"
362+ )
365363 """ ),
366364 )
367365 subdir .joinpath ("test_sub.py" ).write_text (
@@ -372,7 +370,7 @@ async def test_uses_sub_loop():
372370 pytest_plugins = "pytest_asyncio"
373371
374372 @pytest.mark.asyncio
375- async def test_uses_sub_loop ():
373+ async def test_sub_uses_sub_loop ():
376374 assert type(asyncio.get_running_loop()).__name__ == "SubCustomEventLoop"
377375 """ ),
378376 )
0 commit comments