Socket
Socket
Sign inDemoInstall

async-factory-boy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-factory-boy

factory_boy extension with asynchronous ORM support


Maintainers
1

async_factory_boy

factory_boy <https://github.com/FactoryBoy/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

.. code:: python

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

.. code:: python

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

.. code:: python

test = await TestModelFactory.create() test = await TestModelFactory.build()

For test configuration examples check tests/ directory. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc