factory_boy extension with asynchronous ORM support
Project description
factory_boy extension with asynchronous ORM support
Requirements
python (3.8, 3.9, 3.10)
Instalation
Install using pip
pip install async_factory_boy
Usage
async_factory_boy integrate with Object Relational Mapping (ORM) through subclass of factory.Factory. All supported are listed below.
SQLAlchemy, with async_factory_boy.factory.sqlalchemy.AsyncSQLAlchemyFactory
from async_factory_boy.factory.sqlalchemy import AsyncSQLAlchemyFactory
class TestModelFactory(AsyncSQLAlchemyFactory):
class Meta:
model = TestModel
session = session
name = Faker("name")
created_at = Faker("date_time")
Tortoise ORM, with async_factory_boy.factory.tortoise.AsyncTortoiseFactory
from async_factory_boy.factory.tortoise import AsyncTortoiseFactory
class TestModelFactory(AsyncTortoiseFactory):
class Meta:
model = TestModel
name = Faker("name")
created_at = Faker("date_time")
and factory usage
test = await TestModelFactory.create()
test = await TestModelFactory.build()
For test configuration examples check tests/ directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for async_factory_boy-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0a652776ee164b60a45be06aca44a18781710447de1c534dda82d6cfe23f026 |
|
MD5 | 7688815c278017376c95d59a47d20103 |
|
BLAKE2b-256 | 79aa244bc0c1a1076217648d8268503656d5f08f9d7c319d4115fd13118dae1a |