Factory-boy

Latest version: v3.3.1

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

Scan your dependencies

Page 5 of 8

2.4.0

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

*New:*

- Add support for :attr:`factory.fuzzy.FuzzyInteger.step`, thanks to `ilya-pirogov <https://github.com/ilya-pirogov>`_ (:pr:`120`)
- Add :meth:`~factory.django.mute_signals` decorator to temporarily disable some signals, thanks to `ilya-pirogov <https://github.com/ilya-pirogov>`_ (:pr:`122`)
- Add :class:`~factory.fuzzy.FuzzyFloat` (:issue:`124`)
- Declare target model and other non-declaration fields in a ``class Meta`` section.

*Deprecation:*

- Use of ``FACTORY_FOR`` and other ``FACTORY`` class-level attributes is deprecated and will be removed in 2.5.
Those attributes should now declared within the :class:`class Meta <factory.FactoryOptions>` attribute:

For :class:`factory.Factory`:

* Rename ``factory.Factory.FACTORY_FOR`` to :attr:`~factory.FactoryOptions.model`
* Rename ``factory.Factory.ABSTRACT_FACTORY`` to :attr:`~factory.FactoryOptions.abstract`
* Rename ``factory.Factory.FACTORY_STRATEGY`` to :attr:`~factory.FactoryOptions.strategy`
* Rename ``factory.Factory.FACTORY_ARG_PARAMETERS`` to :attr:`~factory.FactoryOptions.inline_args`
* Rename ``factory.Factory.FACTORY_HIDDEN_ARGS`` to :attr:`~factory.FactoryOptions.exclude`

For :class:`factory.django.DjangoModelFactory`:

* Rename ``factory.django.DjangoModelFactory.FACTORY_DJANGO_GET_OR_CREATE`` to :attr:`~factory.django.DjangoOptions.django_get_or_create`

For :class:`factory.alchemy.SQLAlchemyModelFactory`:

* Rename ``factory.alchemy.SQLAlchemyModelFactory.FACTORY_SESSION`` to :attr:`~factory.alchemy.SQLAlchemyOptions.sqlalchemy_session`

2.3.1

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

*Bug fix:*

- Fix badly written assert containing state-changing code, spotted by ``chsigi`` (:pr:`126`)
- Don't crash when handling objects whose ``__repr__`` is non-pure-ASCII bytes on Python 2,
discovered by `mbertheau <https://github.com/mbertheau>`_ (:issue:`123`) and `strycore <https://github.com/strycore>`_ (:pr:`127`)

2.3.0

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

*New:*

- Add :class:`~factory.fuzzy.FuzzyText`, thanks to `jdufresne <https://github.com/jdufresne>`_ (:pr:`97`)
- Add :class:`~factory.fuzzy.FuzzyDecimal`, thanks to `thedrow <https://github.com/thedrow>`_ (:pr:`94`)
- Add support for :class:`~mongoengine.EmbeddedDocument`, thanks to `imiric <https://github.com/imiric>`_ (:pr:`100`)

2.2.1

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

*Bug fix:*

- Fixed sequence counter for :class:`~factory.django.DjangoModelFactory` when a factory
inherits from another factory relating to an abstract model.

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`)

Page 5 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.