factory_boy
===========
.. image:: https://github.com/FactoryBoy/factory_boy/workflows/Test/badge.svg
:target: https://github.com/FactoryBoy/factory_boy/actions?query=workflow%3ATest
.. image:: https://github.com/FactoryBoy/factory_boy/workflows/Check/badge.svg
:target: https://github.com/FactoryBoy/factory_boy/actions?query=workflow%3ACheck
.. image:: https://img.shields.io/pypi/v/factory_boy.svg
:target: https://factoryboy.readthedocs.io/en/latest/changelog.html
:alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/factory_boy.svg
:target: https://pypi.org/project/factory-boy/
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/wheel/factory_boy.svg
:target: https://pypi.org/project/factory-boy/
:alt: Wheel status
.. image:: https://img.shields.io/pypi/l/factory_boy.svg
:target: https://github.com/FactoryBoy/factory_boy/blob/master/LICENSE
:alt: License
factory_boy is a fixtures replacement based on thoughtbot's `factory_bot <https://github.com/thoughtbot/factory_bot>`_.
As a fixtures replacement tool, it aims to replace static, hard to maintain fixtures
with easy-to-use factories for complex objects.
Instead of building an exhaustive test setup with every possible combination of corner cases,
``factory_boy`` allows you to use objects customized for the current test,
while only declaring the test-specific fields:
.. code-block:: python
class FooTests(unittest.TestCase):
def test_with_factory_boy(self):
# We need a 200€, paid order, shipping to australia, for a VIP customer
order = OrderFactory(
amount=200,
status='PAID',
customer__is_vip=True,
address__country='AU',
)
# Run the tests here
def test_without_factory_boy(self):
address = Address(
street="42 fubar street",
zipcode="42Z42",
city="Sydney",
country="AU",
)
customer = Customer(
first_name="John",
last_name="Doe",
phone="+1234",
email="john.doe@example.org",
active=True,
is_vip=True,
address=address,
)
# etc.
factory_boy is designed to work well with various ORMs (Django, MongoDB, SQLAlchemy),
and can easily be extended for other libraries.
Its main features include:
- Straightforward declarative syntax
- Chaining factory calls while retaining the global context
- Support for multiple build strategies (saved/unsaved instances, stubbed objects)
- Multiple factories per class support, including inheritance
Links
-----
* Documentation: https://factoryboy.readthedocs.io/
* Repository: https://github.com/FactoryBoy/factory_boy
* Package: https://pypi.org/project/factory-boy/
* Mailing-list: `factoryboy@googlegroups.com <mailto:factoryboy@googlegroups.com>`_ | https://groups.google.com/forum/#!forum/factoryboy
Download
--------
PyPI: https://pypi.org/project/factory-boy/
.. code-block:: sh
$ pip install factory_boy
Source: https://github.com/FactoryBoy/factory_boy/
.. code-block:: sh
$ git clone git://github.com/FactoryBoy/factory_boy/
$ python setup.py install
Usage
-----
.. note:: This section provides a quick summary of factory_boy features.
A more detailed listing is available in the full documentation.
Defining factories
""""""""""""""""""
Factories declare a set of attributes used to instantiate a Python object.
The class of the object must be defined in the ``model`` field of a ``class Meta:`` attribute:
.. code-block:: python
import factory
from . import models
class UserFactory(factory.Factory):
class Meta:
model = models.User
first_name = 'John'
last_name = 'Doe'
admin = False
# Another, different, factory for the same object
class AdminFactory(factory.Factory):
class Meta:
model = models.User
first_name = 'Admin'
last_name = 'User'
admin = True
ORM integration
"""""""""""""""
factory_boy integration with Object Relational Mapping (ORM) tools is provided
through specific ``factory.Factory`` subclasses:
* Django, with ``factory.django.DjangoModelFactory``
* Mogo, with ``factory.mogo.MogoFactory``
* MongoEngine, with ``factory.mongoengine.MongoEngineFactory``
* SQLAlchemy, with ``factory.alchemy.SQLAlchemyModelFactory``
More details can be found in the ORM section.
Using factories
"""""""""""""""
factory_boy supports several different instantiation strategies: build, create, and stub:
.. code-block:: python
# Returns a User instance that's not saved
user = UserFactory.build()
# Returns a saved User instance.
# UserFactory must subclass an ORM base class, such as DjangoModelFactory.
user = UserFactory.create()
# Returns a stub object (just a bunch of attributes)
obj = UserFactory.stub()
You can use the Factory class as a shortcut for the default instantiation strategy:
.. code-block:: python
# Same as UserFactory.create()
user = UserFactory()
No matter which strategy is used, it's possible to override the defined attributes by passing keyword arguments:
.. code-block:: pycon
# Build a User instance and override first_name
>>> user = UserFactory.build(first_name='Joe')
>>> user.first_name
"Joe"
It is also possible to create a bunch of objects in a single call:
.. code-block:: pycon
>>> users = UserFactory.build_batch(10, first_name="Joe")
>>> len(users)
10
>>> [user.first_name for user in users]
["Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe", "Joe"]
Realistic, random values
""""""""""""""""""""""""
Demos look better with random yet realistic values; and those realistic values can also help discover bugs.
For this, factory_boy relies on the excellent `faker <https://faker.readthedocs.io/en/latest/>`_ library:
.. code-block:: python
class RandomUserFactory(factory.Factory):
class Meta:
model = models.User
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')
.. code-block:: pycon
>>> RandomUserFactory()
<User: Lucy Murray>
Reproducible random values
""""""""""""""""""""""""""
The use of fully randomized data in tests is quickly a problem for reproducing broken builds.
To that purpose, factory_boy provides helpers to handle the random seeds it uses, located in the ``factory.random`` module:
.. code-block:: python
import factory.random
def setup_test_environment():
factory.random.reseed_random('my_awesome_project')
# Other setup here
Lazy Attributes
"""""""""""""""
Most factory attributes can be added using static values that are evaluated when the factory is defined,
but some attributes (such as fields whose value is computed from other elements)
will need values assigned each time an instance is generated.
These "lazy" attributes can be added as follows:
.. code-block:: python
class UserFactory(factory.Factory):
class Meta:
model = models.User
first_name = 'Joe'
last_name = 'Blow'
email = factory.LazyAttribute(lambda a: '{}.{}@example.com'.format(a.first_name, a.last_name).lower())
date_joined = factory.LazyFunction(datetime.now)
.. code-block:: pycon
>>> UserFactory().email
"joe.blow@example.com"
.. note:: ``LazyAttribute`` calls the function with the object being constructed as an argument, when
``LazyFunction`` does not send any argument.
Sequences
"""""""""
Unique values in a specific format (for example, e-mail addresses) can be generated using sequences. Sequences are defined by using ``Sequence`` or the decorator ``sequence``:
.. code-block:: python
class UserFactory(factory.Factory):
class Meta:
model = models.User
email = factory.Sequence(lambda n: 'person{}@example.com'.format(n))
>>> UserFactory().email
'person0@example.com'
>>> UserFactory().email
'person1@example.com'
Associations
""""""""""""
Some objects have a complex field, that should itself be defined from a dedicated factories.
This is handled by the ``SubFactory`` helper:
.. code-block:: python
class PostFactory(factory.Factory):
class Meta:
model = models.Post
author = factory.SubFactory(UserFactory)
The associated object's strategy will be used:
.. code-block:: python
# Builds and saves a User and a Post
>>> post = PostFactory()
>>> post.id is None # Post has been 'saved'
False
>>> post.author.id is None # post.author has been saved
False
# Builds but does not save a User, and then builds but does not save a Post
>>> post = PostFactory.build()
>>> post.id is None
True
>>> post.author.id is None
True
Support Policy
--------------
``factory_boy`` supports active Python versions as well as PyPy3.
- **Python**'s `supported versions
<https://devguide.python.org/versions/#supported-versions>`__.
- **Django**'s `supported
versions <https://www.djangoproject.com/download/#supported-versions>`__.
- **SQLAlchemy**: `latest version on PyPI <https://pypi.org/project/SQLAlchemy/>`__.
- **MongoEngine**: `latest version on PyPI <https://pypi.org/project/mongoengine/>`__.
Debugging factory_boy
---------------------
Debugging factory_boy can be rather complex due to the long chains of calls.
Detailed logging is available through the ``factory`` logger.
A helper, `factory.debug()`, is available to ease debugging:
.. code-block:: python
with factory.debug():
obj = TestModel2Factory()
import logging
logger = logging.getLogger('factory')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
This will yield messages similar to those (artificial indentation):
.. code-block:: ini
BaseFactory: Preparing tests.test_using.TestModel2Factory(extra={})
LazyStub: Computing values for tests.test_using.TestModel2Factory(two=<OrderedDeclarationWrapper for <factory.declarations.SubFactory object at 0x1e15610>>)
SubFactory: Instantiating tests.test_using.TestModelFactory(__containers=(<LazyStub for tests.test_using.TestModel2Factory>,), one=4), create=True
BaseFactory: Preparing tests.test_using.TestModelFactory(extra={'__containers': (<LazyStub for tests.test_using.TestModel2Factory>,), 'one': 4})
LazyStub: Computing values for tests.test_using.TestModelFactory(one=4)
LazyStub: Computed values, got tests.test_using.TestModelFactory(one=4)
BaseFactory: Generating tests.test_using.TestModelFactory(one=4)
LazyStub: Computed values, got tests.test_using.TestModel2Factory(two=<tests.test_using.TestModel object at 0x1e15410>)
BaseFactory: Generating tests.test_using.TestModel2Factory(two=<tests.test_using.TestModel object at 0x1e15410>)
Contributing
------------
factory_boy is distributed under the MIT License.
Issues should be opened through `GitHub Issues <https://github.com/FactoryBoy/factory_boy/issues/>`_; whenever possible, a pull request should be included.
Questions and suggestions are welcome on the `mailing-list <mailto:factoryboy@googlegroups.com>`_.
Development dependencies can be installed in a `virtualenv
<https://docs.python.org/3/tutorial/venv.html>`_ with:
.. code-block:: sh
$ pip install --editable '.[dev]'
All pull requests should pass the test suite, which can be launched simply with:
.. code-block:: sh
$ make testall
In order to test coverage, please use:
.. code-block:: sh
$ make coverage
To test with a specific framework version, you may use a ``tox`` target:
.. code-block:: sh
# list all tox environments
$ tox --listenvs
# run tests inside a specific environment (django/mongoengine/SQLAlchemy are not installed)
$ tox -e py310
# run tests inside a specific environment (django)
$ tox -e py310-djangomain
# run tests inside a specific environment (alchemy)
$ tox -e py310-alchemy
# run tests inside a specific environment (mongoengine)
$ tox -e py310-mongo
Packaging
---------
For users interesting in packaging FactoryBoy into downstream distribution channels
(e.g. ``.deb``, ``.rpm``, ``.ebuild``), the following tips might be helpful:
Dependencies
""""""""""""
The package's run-time dependencies are listed in ``setup.cfg``.
The dependencies useful for building and testing the library are covered by the
``dev`` and ``doc`` extras.
Moreover, all development / testing tasks are driven through ``make(1)``.
Building
""""""""
In order to run the build steps (currently only for docs), run:
.. code-block:: sh
python setup.py egg_info
make doc
Testing
"""""""
When testing for the active Python environment, run the following:
.. code-block:: sh
make test
.. note::
You must make sure that the ``factory`` module is importable, as it is imported from
the testing code.
Raw data
{
"_id": null,
"home_page": "https://github.com/FactoryBoy/factory_boy",
"name": "factory-boy",
"maintainer": "Rapha\u00ebl Barrois",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "raphael.barrois+fboy@polytechnique.org",
"keywords": "factory_boy, factory, fixtures",
"author": "Mark Sandstrom",
"author_email": "mark@deliciouslynerdy.com",
"download_url": "https://files.pythonhosted.org/packages/99/3d/8070dde623341401b1c80156583d4c793058fe250450178218bb6e45526c/factory_boy-3.3.1.tar.gz",
"platform": null,
"description": "factory_boy\n===========\n\n.. image:: https://github.com/FactoryBoy/factory_boy/workflows/Test/badge.svg\n :target: https://github.com/FactoryBoy/factory_boy/actions?query=workflow%3ATest\n\n.. image:: https://github.com/FactoryBoy/factory_boy/workflows/Check/badge.svg\n :target: https://github.com/FactoryBoy/factory_boy/actions?query=workflow%3ACheck\n\n.. image:: https://img.shields.io/pypi/v/factory_boy.svg\n :target: https://factoryboy.readthedocs.io/en/latest/changelog.html\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/factory_boy.svg\n :target: https://pypi.org/project/factory-boy/\n :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/wheel/factory_boy.svg\n :target: https://pypi.org/project/factory-boy/\n :alt: Wheel status\n\n.. image:: https://img.shields.io/pypi/l/factory_boy.svg\n :target: https://github.com/FactoryBoy/factory_boy/blob/master/LICENSE\n :alt: License\n\nfactory_boy is a fixtures replacement based on thoughtbot's `factory_bot <https://github.com/thoughtbot/factory_bot>`_.\n\nAs a fixtures replacement tool, it aims to replace static, hard to maintain fixtures\nwith easy-to-use factories for complex objects.\n\nInstead of building an exhaustive test setup with every possible combination of corner cases,\n``factory_boy`` allows you to use objects customized for the current test,\nwhile only declaring the test-specific fields:\n\n.. code-block:: python\n\n class FooTests(unittest.TestCase):\n\n def test_with_factory_boy(self):\n # We need a 200\u20ac, paid order, shipping to australia, for a VIP customer\n order = OrderFactory(\n amount=200,\n status='PAID',\n customer__is_vip=True,\n address__country='AU',\n )\n # Run the tests here\n\n def test_without_factory_boy(self):\n address = Address(\n street=\"42 fubar street\",\n zipcode=\"42Z42\",\n city=\"Sydney\",\n country=\"AU\",\n )\n customer = Customer(\n first_name=\"John\",\n last_name=\"Doe\",\n phone=\"+1234\",\n email=\"john.doe@example.org\",\n active=True,\n is_vip=True,\n address=address,\n )\n # etc.\n\nfactory_boy is designed to work well with various ORMs (Django, MongoDB, SQLAlchemy),\nand can easily be extended for other libraries.\n\nIts main features include:\n\n- Straightforward declarative syntax\n- Chaining factory calls while retaining the global context\n- Support for multiple build strategies (saved/unsaved instances, stubbed objects)\n- Multiple factories per class support, including inheritance\n\n\nLinks\n-----\n\n* Documentation: https://factoryboy.readthedocs.io/\n* Repository: https://github.com/FactoryBoy/factory_boy\n* Package: https://pypi.org/project/factory-boy/\n* Mailing-list: `factoryboy@googlegroups.com <mailto:factoryboy@googlegroups.com>`_ | https://groups.google.com/forum/#!forum/factoryboy\n\n\nDownload\n--------\n\nPyPI: https://pypi.org/project/factory-boy/\n\n.. code-block:: sh\n\n $ pip install factory_boy\n\nSource: https://github.com/FactoryBoy/factory_boy/\n\n.. code-block:: sh\n\n $ git clone git://github.com/FactoryBoy/factory_boy/\n $ python setup.py install\n\n\nUsage\n-----\n\n\n.. note:: This section provides a quick summary of factory_boy features.\n A more detailed listing is available in the full documentation.\n\n\nDefining factories\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nFactories declare a set of attributes used to instantiate a Python object.\nThe class of the object must be defined in the ``model`` field of a ``class Meta:`` attribute:\n\n.. code-block:: python\n\n import factory\n from . import models\n\n class UserFactory(factory.Factory):\n class Meta:\n model = models.User\n\n first_name = 'John'\n last_name = 'Doe'\n admin = False\n\n # Another, different, factory for the same object\n class AdminFactory(factory.Factory):\n class Meta:\n model = models.User\n\n first_name = 'Admin'\n last_name = 'User'\n admin = True\n\n\nORM integration\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nfactory_boy integration with Object Relational Mapping (ORM) tools is provided\nthrough specific ``factory.Factory`` subclasses:\n\n* Django, with ``factory.django.DjangoModelFactory``\n* Mogo, with ``factory.mogo.MogoFactory``\n* MongoEngine, with ``factory.mongoengine.MongoEngineFactory``\n* SQLAlchemy, with ``factory.alchemy.SQLAlchemyModelFactory``\n\nMore details can be found in the ORM section.\n\n\nUsing factories\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nfactory_boy supports several different instantiation strategies: build, create, and stub:\n\n.. code-block:: python\n\n # Returns a User instance that's not saved\n user = UserFactory.build()\n\n # Returns a saved User instance.\n # UserFactory must subclass an ORM base class, such as DjangoModelFactory.\n user = UserFactory.create()\n\n # Returns a stub object (just a bunch of attributes)\n obj = UserFactory.stub()\n\n\nYou can use the Factory class as a shortcut for the default instantiation strategy:\n\n.. code-block:: python\n\n # Same as UserFactory.create()\n user = UserFactory()\n\n\nNo matter which strategy is used, it's possible to override the defined attributes by passing keyword arguments:\n\n.. code-block:: pycon\n\n # Build a User instance and override first_name\n >>> user = UserFactory.build(first_name='Joe')\n >>> user.first_name\n \"Joe\"\n\n\nIt is also possible to create a bunch of objects in a single call:\n\n.. code-block:: pycon\n\n >>> users = UserFactory.build_batch(10, first_name=\"Joe\")\n >>> len(users)\n 10\n >>> [user.first_name for user in users]\n [\"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\", \"Joe\"]\n\n\nRealistic, random values\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nDemos look better with random yet realistic values; and those realistic values can also help discover bugs.\nFor this, factory_boy relies on the excellent `faker <https://faker.readthedocs.io/en/latest/>`_ library:\n\n.. code-block:: python\n\n class RandomUserFactory(factory.Factory):\n class Meta:\n model = models.User\n\n first_name = factory.Faker('first_name')\n last_name = factory.Faker('last_name')\n\n.. code-block:: pycon\n\n >>> RandomUserFactory()\n <User: Lucy Murray>\n\n\nReproducible random values\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe use of fully randomized data in tests is quickly a problem for reproducing broken builds.\nTo that purpose, factory_boy provides helpers to handle the random seeds it uses, located in the ``factory.random`` module:\n\n.. code-block:: python\n\n import factory.random\n\n def setup_test_environment():\n factory.random.reseed_random('my_awesome_project')\n # Other setup here\n\n\nLazy Attributes\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nMost factory attributes can be added using static values that are evaluated when the factory is defined,\nbut some attributes (such as fields whose value is computed from other elements)\nwill need values assigned each time an instance is generated.\n\nThese \"lazy\" attributes can be added as follows:\n\n.. code-block:: python\n\n class UserFactory(factory.Factory):\n class Meta:\n model = models.User\n\n first_name = 'Joe'\n last_name = 'Blow'\n email = factory.LazyAttribute(lambda a: '{}.{}@example.com'.format(a.first_name, a.last_name).lower())\n date_joined = factory.LazyFunction(datetime.now)\n\n.. code-block:: pycon\n\n >>> UserFactory().email\n \"joe.blow@example.com\"\n\n\n.. note:: ``LazyAttribute`` calls the function with the object being constructed as an argument, when\n ``LazyFunction`` does not send any argument.\n\n\nSequences\n\"\"\"\"\"\"\"\"\"\n\nUnique values in a specific format (for example, e-mail addresses) can be generated using sequences. Sequences are defined by using ``Sequence`` or the decorator ``sequence``:\n\n.. code-block:: python\n\n class UserFactory(factory.Factory):\n class Meta:\n model = models.User\n\n email = factory.Sequence(lambda n: 'person{}@example.com'.format(n))\n\n >>> UserFactory().email\n 'person0@example.com'\n >>> UserFactory().email\n 'person1@example.com'\n\n\nAssociations\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nSome objects have a complex field, that should itself be defined from a dedicated factories.\nThis is handled by the ``SubFactory`` helper:\n\n.. code-block:: python\n\n class PostFactory(factory.Factory):\n class Meta:\n model = models.Post\n\n author = factory.SubFactory(UserFactory)\n\n\nThe associated object's strategy will be used:\n\n\n.. code-block:: python\n\n # Builds and saves a User and a Post\n >>> post = PostFactory()\n >>> post.id is None # Post has been 'saved'\n False\n >>> post.author.id is None # post.author has been saved\n False\n\n # Builds but does not save a User, and then builds but does not save a Post\n >>> post = PostFactory.build()\n >>> post.id is None\n True\n >>> post.author.id is None\n True\n\nSupport Policy\n--------------\n\n``factory_boy`` supports active Python versions as well as PyPy3.\n\n- **Python**'s `supported versions\n <https://devguide.python.org/versions/#supported-versions>`__.\n- **Django**'s `supported\n versions <https://www.djangoproject.com/download/#supported-versions>`__.\n- **SQLAlchemy**: `latest version on PyPI <https://pypi.org/project/SQLAlchemy/>`__.\n- **MongoEngine**: `latest version on PyPI <https://pypi.org/project/mongoengine/>`__.\n\nDebugging factory_boy\n---------------------\n\nDebugging factory_boy can be rather complex due to the long chains of calls.\nDetailed logging is available through the ``factory`` logger.\n\nA helper, `factory.debug()`, is available to ease debugging:\n\n.. code-block:: python\n\n with factory.debug():\n obj = TestModel2Factory()\n\n\n import logging\n logger = logging.getLogger('factory')\n logger.addHandler(logging.StreamHandler())\n logger.setLevel(logging.DEBUG)\n\nThis will yield messages similar to those (artificial indentation):\n\n.. code-block:: ini\n\n BaseFactory: Preparing tests.test_using.TestModel2Factory(extra={})\n LazyStub: Computing values for tests.test_using.TestModel2Factory(two=<OrderedDeclarationWrapper for <factory.declarations.SubFactory object at 0x1e15610>>)\n SubFactory: Instantiating tests.test_using.TestModelFactory(__containers=(<LazyStub for tests.test_using.TestModel2Factory>,), one=4), create=True\n BaseFactory: Preparing tests.test_using.TestModelFactory(extra={'__containers': (<LazyStub for tests.test_using.TestModel2Factory>,), 'one': 4})\n LazyStub: Computing values for tests.test_using.TestModelFactory(one=4)\n LazyStub: Computed values, got tests.test_using.TestModelFactory(one=4)\n BaseFactory: Generating tests.test_using.TestModelFactory(one=4)\n LazyStub: Computed values, got tests.test_using.TestModel2Factory(two=<tests.test_using.TestModel object at 0x1e15410>)\n BaseFactory: Generating tests.test_using.TestModel2Factory(two=<tests.test_using.TestModel object at 0x1e15410>)\n\nContributing\n------------\n\nfactory_boy is distributed under the MIT License.\n\nIssues should be opened through `GitHub Issues <https://github.com/FactoryBoy/factory_boy/issues/>`_; whenever possible, a pull request should be included.\nQuestions and suggestions are welcome on the `mailing-list <mailto:factoryboy@googlegroups.com>`_.\n\nDevelopment dependencies can be installed in a `virtualenv\n<https://docs.python.org/3/tutorial/venv.html>`_ with:\n\n.. code-block:: sh\n\n $ pip install --editable '.[dev]'\n\nAll pull requests should pass the test suite, which can be launched simply with:\n\n.. code-block:: sh\n\n $ make testall\n\n\n\nIn order to test coverage, please use:\n\n.. code-block:: sh\n\n $ make coverage\n\n\nTo test with a specific framework version, you may use a ``tox`` target:\n\n.. code-block:: sh\n\n # list all tox environments\n $ tox --listenvs\n\n # run tests inside a specific environment (django/mongoengine/SQLAlchemy are not installed)\n $ tox -e py310\n\n # run tests inside a specific environment (django)\n $ tox -e py310-djangomain\n\n # run tests inside a specific environment (alchemy)\n $ tox -e py310-alchemy\n\n # run tests inside a specific environment (mongoengine)\n $ tox -e py310-mongo\n\n\nPackaging\n---------\n\nFor users interesting in packaging FactoryBoy into downstream distribution channels\n(e.g. ``.deb``, ``.rpm``, ``.ebuild``), the following tips might be helpful:\n\nDependencies\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe package's run-time dependencies are listed in ``setup.cfg``.\nThe dependencies useful for building and testing the library are covered by the\n``dev`` and ``doc`` extras.\n\nMoreover, all development / testing tasks are driven through ``make(1)``.\n\nBuilding\n\"\"\"\"\"\"\"\"\n\nIn order to run the build steps (currently only for docs), run:\n\n.. code-block:: sh\n\n python setup.py egg_info\n make doc\n\nTesting\n\"\"\"\"\"\"\"\n\nWhen testing for the active Python environment, run the following:\n\n.. code-block:: sh\n\n make test\n\n.. note::\n\n You must make sure that the ``factory`` module is importable, as it is imported from\n the testing code.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A versatile test fixtures replacement based on thoughtbot's factory_bot for Ruby.",
"version": "3.3.1",
"project_urls": {
"Homepage": "https://github.com/FactoryBoy/factory_boy"
},
"split_keywords": [
"factory_boy",
" factory",
" fixtures"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "33cf44ec67152f3129d0114c1499dd34f0a0a0faf43d9c2af05bc535746ca482",
"md5": "adfc9787544914bd242296df7b449619",
"sha256": "7b1113c49736e1e9995bc2a18f4dbf2c52cf0f841103517010b1d825712ce3ca"
},
"downloads": -1,
"filename": "factory_boy-3.3.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "adfc9787544914bd242296df7b449619",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 36878,
"upload_time": "2024-08-18T19:40:58",
"upload_time_iso_8601": "2024-08-18T19:40:58.067041Z",
"url": "https://files.pythonhosted.org/packages/33/cf/44ec67152f3129d0114c1499dd34f0a0a0faf43d9c2af05bc535746ca482/factory_boy-3.3.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "993d8070dde623341401b1c80156583d4c793058fe250450178218bb6e45526c",
"md5": "f3ea85ca5ad5b3c906b87d82ae53db67",
"sha256": "8317aa5289cdfc45f9cae570feb07a6177316c82e34d14df3c2e1f22f26abef0"
},
"downloads": -1,
"filename": "factory_boy-3.3.1.tar.gz",
"has_sig": false,
"md5_digest": "f3ea85ca5ad5b3c906b87d82ae53db67",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 163924,
"upload_time": "2024-08-18T19:41:00",
"upload_time_iso_8601": "2024-08-18T19:41:00.212176Z",
"url": "https://files.pythonhosted.org/packages/99/3d/8070dde623341401b1c80156583d4c793058fe250450178218bb6e45526c/factory_boy-3.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-18 19:41:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FactoryBoy",
"github_project": "factory_boy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "factory-boy"
}