factory_boy icon indicating copy to clipboard operation
factory_boy copied to clipboard

Support Django 4.1 Asynchronous ORM interface

Open qcoumes opened this issue 2 years ago • 0 comments

To instantiate a Django's models with factory_boy within an async context, we currently need to wrap it with sync_to_async, e.g. workspace = await sync_to_async(WorkspaceFactory)().

It would be awesome if DjangoModelFactory could provide a .acreate() method, which either encapsulates the call to sync_to_async or even better, uses the new Asynchronous ORM interface from Django 4.1.

The latter would automatically benefit from any future development of Django's async ORM.

qcoumes avatar Oct 17 '22 02:10 qcoumes