An extension for factory_boy that adds asynchronous ORM support, enabling creation of model instances with async-compatible factories. Current version is 1.0.1, released in 2024. Maintained actively.
pip install async-factory-boyVerified import paths — ran on the pinned version, not inferred.
Define an async factory for a SQLAlchemy model and create an instance asynchronously.
Always pass a session when creating instances. Use an async fixture to provide the session.
Replace factory.create() with await factory.create_async().
Use dedicated factory classes for your ORM (e.g., AsyncSQLAlchemyModelFactory) instead of AsyncFactory.
Always pass `sqlalchemy_session` keyword argument to `create_async()`.