--- id: async-factory-boy version: "1.0.1" license: MIT license_treatment: permissive maintenance: dormant --- # async-factory-boy — factory_boy extension with asynchronous ORM support License: permissive · Maintenance: dormant · Downloads: 199.2K/mo ## What it is and what it does async_factory_boy is a factory_boy extension that wraps asynchronous ORM operations, letting you define test fixtures for SQLAlchemy and Tortoise ORM using async/await syntax. Instead of blocking database calls in your test factories, you call `await TestModelFactory.create()` or `await TestModelFactory.build()` to generate test data asynchronously. The package works by subclassing factory_boy's Factory and providing ORM-specific variants (AsyncSQLAlchemyFactory, AsyncTortoiseFactory) that handle async session management. It integrates with factory_boy's Faker support for generating realistic field values. The single runtime dependency is factory-boy itself, making installation straightforward. Use it for: - Generate test data in async test suites without blocking the event loop or wrapping factories in sync wrappers. - Build SQLAlchemy async session fixtures for pytest-asyncio or similar async test frameworks. - Create Tortoise ORM test models in async test code without falling back to synchronous factory patterns. - Populate test databases in async integration tests where the application code is fully async. - Reduce boilerplate in async test setup by reusing factory definitions across multiple test modules. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extends factory_boy to generate test fixtures asynchronously for SQLAlchemy and Tortoise ORM, allowing async database operations in test factories. Yes, if you are writing async tests for SQLAlchemy or Tortoise ORM and want to avoid sync-to-async bridging in your factories. The low install friction and permissive license are favorable. However, dormant maintenance (last release August 2023, last commit June 2024) means you should verify compatibility with your ORM versions and be prepared to fork or patch if issues arise. No known vulnerabilities. ## Install pip install async-factory-boy uv add async-factory-boy poetry add async-factory-boy ## Installing async-factory-boy Before you install: Low install friction with a single dependency on factory-boy. Maintenance is dormant—last commit was 2024-06-12 and no releases since 2023-08-12—so expect no active bug fixes or feature updates, though the codebase is not archived. License in practice: MIT license is permissive; you can use, modify, and distribute this package with minimal legal friction. Quickstart: pip install async_factory_boy from async_factory_boy.factory.sqlalchemy import AsyncSQLAlchemyFactory class TestModelFactory(AsyncSQLAlchemyFactory): class Meta: model = TestModel session = session name = Faker("name") test = await TestModelFactory.create() Requires Python 3.8 or later; async/await syntax is mandatory for usage. Verify before relying: - Whether the package works with current versions of SQLAlchemy's async API (sqlalchemy.ext.asyncio) or only legacy async patterns. - Whether Tortoise ORM support is actively maintained or if breaking changes in Tortoise have introduced compatibility issues. - Real-world test coverage and whether dormancy signals unresolved issues or simply stable, complete functionality. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 199.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async factory fixtures, factory_boy async orm, sqlalchemy async test factory, tortoise orm test fixtures, async database test data generation, async factory pattern, orm async factory, async-testing, orm-fixtures, factory-pattern [View on SkillFed](https://skillfed.io/packages/async-factory-boy) · [View on PyPI](https://pypi.org/project/async-factory-boy/)