Closed jonathanblade closed 5 months ago
I realized my mistake. It is wrong scope. Fixture should be like:
@pytest.fixture()
async def db_session(container: dishka.AsyncContainer) -> AsyncSession:
async with container(scope=Scope.REQUEST) as request_scope_container:
return await request_scope_container.get(AsyncSession)
Hi! I created
DbProvider
:But in tests i got error: dishka.exceptions.NoFactoryError: Cannot find factory for (<class 'sqlalchemy.ext.asyncio.session.AsyncSession'>, component=''). Check scopes in your providers. It is missing or has invalid scope.
dishka version:
1.1.1