`loop_scope="package"` raises a `fixture not found` error
NoahStapp opened this issue · 7 comments
When using loop_scope="package", this fixture defined in my test/asynchronous/conftest.py throws a fatal error on test setup:
@pytest_asyncio.fixture(loop_scope="package", scope="package", autouse=True)
async def test_setup_and_teardown():
await async_setup()
yield
await async_teardown()
# Error:
E fixture 'test/asynchronous::<event_loop>' not found
Every other loop_scope does not throw this error. Is there an additional step required for package scoped fixtures?
@NoahStapp Thanks! This looks like a bug, indeed.
Can you also share the directory layout around the conftest, especially any init.py files?
My assumption is that autouse=True causes the fixture to be injected in tests that don't have a surrounding package.
@NoahStapp Thanks! This looks like a bug, indeed.
Can you also share the directory layout around the conftest, especially any init.py files? My assumption is that
autouse=Truecauses the fixture to be injected in tests that don't have a surrounding package.
Sure, here's the layout:
test
├── __init__.py
├── asynchronous
│ ├── __init__.py
│ ├── conftest.py
│ ├── # asynchronous test files...
├── conftest.py
├── # synchronous test files...
We use pytest-asyncio for our asynchronous test suite and pytest for our synchronous test suite.