Describe the issue
Async tests (e.g. pytest-asyncio) don't seem to be supported
To Reproduce
A basic example, from a django-ninja app with an async endpoint
@pytest.mark.asyncio
async def test_get(client: TestAsyncClient) -> None:
brand = baker.make(Brand)
...
gives:
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
Expected behavior
It would be great to see this just work! Model bakery is possibly one of the best testing utility libraries I've ever used, and almost my exclusive reason to use django. It'd be great to see this work with the async endpoints.
Versions
- Python: 3.12
- Django 5.2.6
- Model Bakery 1.20.5
Describe the issue
Async tests (e.g. pytest-asyncio) don't seem to be supported
To Reproduce
A basic example, from a
django-ninjaapp with an async endpointgives:
Expected behavior
It would be great to see this just work! Model bakery is possibly one of the best testing utility libraries I've ever used, and almost my exclusive reason to use django. It'd be great to see this work with the async endpoints.
Versions