Factory-boy

Latest version: v3.3.3

Safety actively analyzes 722296 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 9

2.2.0

------------------

*Bug fix:*

- Removed duplicated :class:`~factory.alchemy.SQLAlchemyModelFactory` lurking in :mod:`factory`
(:pr:`83`)
- Properly handle sequences within object inheritance chains.
If ``FactoryA`` inherits from ``FactoryB``, and their associated classes
share the same link, sequence counters will be shared (:issue:`93`)
- Properly handle nested :class:`~factory.SubFactory` overrides

*New:*

- The :class:`~factory.django.DjangoModelFactory` now supports the ``FACTORY_FOR = 'myapp.MyModel'``
syntax, making it easier to shove all factories in a single module (:issue:`66`).
- Add :meth:`factory.debug()` helper for easier backtrace analysis
- Adding factory support for mongoengine with :class:`~factory.mongoengine.MongoEngineFactory`.

2.1.2

------------------

*New:*

- The ``factory.Factory.ABSTRACT_FACTORY`` keyword is now optional, and automatically set
to ``True`` if neither the :class:`~factory.Factory` subclass nor its parent declare the
``factory.Factory.FACTORY_FOR`` attribute (:issue:`74`)

2.1.1

------------------

*Bug fix:*

- Properly retrieve the ``color`` keyword argument passed to :class:`~factory.django.ImageField`

2.1.0

------------------

*New:*

- Add :class:`~factory.fuzzy.FuzzyDate` thanks to `saulshanabrook <https://github.com/saulshanabrook>`_
- Add :class:`~factory.fuzzy.FuzzyDateTime` and :class:`~factory.fuzzy.FuzzyNaiveDateTime`.
- Add a ``factory_parent`` attribute to the
``factory.builder.Resolver`` passed to :class:`~factory.LazyAttribute`, in order to access
fields defined in wrapping factories.
- Move :class:`~factory.django.DjangoModelFactory` and :class:`~factory.mogo.MogoFactory`
to their own modules (:mod:`factory.django` and :mod:`factory.mogo`)
- Add the :meth:`~factory.Factory.reset_sequence` classmethod to :class:`~factory.Factory`
to ease resetting the sequence counter for a given factory.
- Add debug messages to ``factory`` logger.
- Add a :meth:`~factory.Iterator.reset` method to :class:`~factory.Iterator` (:issue:`63`)
- Add support for the SQLAlchemy ORM through :class:`~factory.alchemy.SQLAlchemyModelFactory`
(:pr:`64`, thanks to `Romain Commandé <https://github.com/rcommande>`_)
- Add :class:`factory.django.FileField` and :class:`factory.django.ImageField` hooks for
related Django model fields (:issue:`52`)

*Bug fix*

- Properly handle non-integer primary keys in :class:`~factory.django.DjangoModelFactory` (:issue:`57`).
- Disable :class:`~factory.RelatedFactory` generation when a specific value was
passed (:issue:`62`, thanks to `Gabe Koscky <https://github.com/dhekke>`_)

*Deprecation:*

- Rename :class:`~factory.RelatedFactory`'s ``name`` argument to ``factory_related_name`` (See :issue:`58`)

2.0.2

------------------

*New:*

- When ``factory.django.DjangoModelFactory.FACTORY_DJANGO_GET_OR_CREATE`` is
empty, use ``Model.objects.create()`` instead of ``Model.objects.get_or_create``.

2.0.1

------------------

*New:*

- Don't push ``defaults`` to ``get_or_create`` when
``factory.django.DjangoModelFactory.FACTORY_DJANGO_GET_OR_CREATE`` is not set.

Page 6 of 9

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.