Skip to content

Latest commit

 

History

History
827 lines (533 loc) · 29.5 KB

changelog.rst

File metadata and controls

827 lines (533 loc) · 29.5 KB

ChangeLog

3.3.0 (unreleased)

New:

Bugfix:

Deprecated:

Removed:

3.2.0 (2020-12-28)

New:

  • Add support for Django 3.1
  • Add support for Python 3.9

Removed:

Deprecated:

Bug fix:

3.1.0 (2020-10-02)

New:

  • Allow all types of declarations in :class:`factory.Faker` calls - enables references to other faker-defined attributes.

3.0.1 (2020-08-13)

Bug fix:

  • :issue:`769`: Fix import factory; factory.django.DjangoModelFactory and similar calls.

3.0.0 (2020-08-12)

Breaking changes

The following aliases were removed:

Broken alias New import
from factory import DjangoModelFactory from factory.django import DjangoModelFactory
from factory import MogoFactory from factory.mogo import MogoFactory
from factory.fuzzy import get_random_state from factory.random import get_random_state
from factory.fuzzy import set_random_state from factory.random import set_random_state
from factory.fuzzy import reseed_random from factory.random import reseed_random

Removed:

  • Drop support for Python 2 and 3.4. These versions are not maintained anymore.
  • Drop support for Django 2.0 and 2.1. These versions are not maintained anymore.
  • Remove deprecated force_flush from SQLAlchemyModelFactory options. Use sqlalchemy_session_persistence = "flush" instead.
  • Drop deprecated attributes() from :class:`~factory.Factory` subclasses; use factory.make_factory(dict, FactoryClass._meta.pre_declarations) instead.
  • Drop deprecated declarations() from :class:`~factory.Factory` subclasses; use FactoryClass._meta.pre_declarations instead.
  • Drop factory.compat module.

New:

Improvements:

Bug fix:

  • Fix issue with SubFactory not preserving signal muting behavior of the used factory, thanks Patrick Stein.
  • Fix issue with overriding parameters in a Trait, thanks Grégoire Rocher.
  • :issue:`598`: Limit get_or_create behavior to fields specified in django_get_or_create.
  • :issue:`606`: Re-raise :class:`~django.db.IntegrityError` when django_get_or_create with multiple fields fails to lookup model using user provided keyword arguments.
  • :issue:`630`: TypeError masked by __repr__ AttributeError when initializing Maybe with inconsistent phases.

2.12.0 (2019-05-11)

New:

Bug fix:

2.11.1 (2018-05-05)

Bug fix:

2.11.0 (2018-05-05)

Bug fix:

2.10.0 (2018-01-28)

Bug fix:

New:

2.9.2 (2017-08-03)

Bug fix:

  • Fix declaration corruption bug when a factory defined foo__bar__baz=1 and a caller provided a foo__bar=x parameter at call time: this got merged into the factory's base declarations.

2.9.1 (2017-08-02)

Bug fix:

2.9.0 (2017-07-30)

This version brings massive changes to the core engine, thus reducing the number of corner cases and weird behaviors.

New:

Deprecation:

  • factory.fuzzy.get_random_state is deprecated, factory.random.get_random_state should be used instead.
  • factory.fuzzy.set_random_state is deprecated, factory.random.set_random_state should be used instead.
  • factory.fuzzy.reseed_random is deprecated, factory.random.reseed_random should be used instead.

2.8.1 (2016-12-17)

Bug fix:

  • Fix packaging issues.

2.8.0 (2016-12-17)

New:

Bug fix:

2.7.0 (2016-04-19)

New:

Removed:

  • :pr:`278`: Formally drop support for Python2.6

Warning

Version 2.7.0 moves all error classes to factory.errors. This breaks existing import statements for any error classes except those importing FactoryError directly from the factory module.

2.6.1 (2016-02-10)

New:

2.6.0 (2015-10-20)

New:

  • Add :attr:`factory.FactoryOptions.rename` to help handle conflicting names (:issue:`206`)
  • Add support for random-yet-realistic values through fake-factory, through the :class:`factory.Faker` class.
  • :class:`factory.Iterator` no longer begins iteration of its argument at import time, thus allowing to pass in a lazy iterator such as a Django queryset (i.e factory.Iterator(models.MyThingy.objects.all())).
  • Simplify imports for ORM layers, now available through a simple factory import, at factory.alchemy.SQLAlchemyModelFactory / factory.django.DjangoModelFactory / factory.mongoengine.MongoEngineFactory.

Bug fix:

2.5.2 (2015-04-21)

Bug fix:

  • Add support for Django 1.7/1.8
  • Add support for mongoengine>=0.9.0 / pymongo>=2.1

2.5.1 (2015-03-27)

Bug fix:

2.5.0 (2015-03-26)

New:

Bug fix:

Deprecation:

Warning

Version 2.5.0 removes the 'auto-magical sequence setup' bug-and-feature. This could trigger some bugs when tests expected a non-zero sequence reference.

Upgrading

Warning

Version 2.5.0 removes features that were marked as deprecated in :ref:`v2.4.0 <v2.4.0>`.

All FACTORY_*-style attributes are now declared in a class Meta: section:

# Old-style, deprecated
class MyFactory(factory.Factory):
    FACTORY_FOR = models.MyModel
    FACTORY_HIDDEN_ARGS = ['a', 'b', 'c']

# New-style
class MyFactory(factory.Factory):
    class Meta:
        model = models.MyModel
        exclude = ['a', 'b', 'c']

A simple shell command to upgrade the code would be:

# sed -i: inplace update
# grep -l: only file names, not matching lines
sed -i 's/FACTORY_FOR =/class Meta:\n        model =/' $(grep -l FACTORY_FOR $(find . -name '*.py'))

This takes care of all FACTORY_FOR occurrences; the files containing other attributes to rename can be found with grep -R FACTORY .

2.4.1 (2014-06-23)

Bug fix:

  • Fix overriding deeply inherited attributes (set in one factory, overridden in a subclass, used in a sub-sub-class).

2.4.0 (2014-06-21)

New:

Deprecation:

2.3.1 (2014-01-22)

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 (:issue:`123`) and strycore (:pr:`127`)

2.3.0 (2013-12-25)

New:

2.2.1 (2013-09-24)

Bug fix:

2.2.0 (2013-09-24)

Bug fix:

New:

2.1.2 (2013-08-14)

New:

2.1.1 (2013-07-02)

Bug fix:

2.1.0 (2013-06-26)

New:

Bug fix

Deprecation:

2.0.2 (2013-04-16)

New:

2.0.1 (2013-04-16)

New:

2.0.0 (2013-04-15)

New:

Removed:

1.3.0 (2013-03-11)

Warning

This version deprecates many magic or unexplicit features that will be removed in v2.0.0.

Please read the :ref:`changelog-1-3-0-upgrading` section, then run your tests with python -W default to see all remaining warnings.

New

Pending deprecation

The following features have been deprecated and will be removed in an upcoming release.

Upgrading

This version deprecates a few magic or undocumented features. All warnings will turn into errors starting from v2.0.0.

In order to upgrade client code, apply the following rules:

  • Add a FACTORY_FOR attribute pointing to the target class to each :class:`~factory.Factory`, instead of relying on automatic associated class discovery
  • When using factory_boy for Django models, have each factory inherit from :class:`~factory.django.DjangoModelFactory`
  • Replace factory.CircularSubFactory('some.module', 'Symbol') with factory.SubFactory('some.module.Symbol')
  • Replace factory.InfiniteIterator(iterable) with factory.Iterator(iterable)
  • Replace @factory.post_generation() with @factory.post_generation
  • Replace factory.set_building_function(SomeFactory, building_function) with an override of the :meth:`~factory.Factory._build` method of SomeFactory
  • Replace factory.set_creation_function(SomeFactory, creation_function) with an override of the :meth:`~factory.Factory._create` method of SomeFactory

1.2.0 (2012-09-08)

New:

1.1.5 (2012-07-09)

Bug fix:

1.1.4 (2012-06-19)

New:

1.1.3 (2012-03-09)

Bug fix:

  • Fix packaging rules

1.1.2 (2012-02-25)

New:

1.1.1 (2012-02-24)

New:

1.1.0 (2012-02-24)

New:

Bug fix:

  • Allow classmethod/staticmethod on factories

Deprecation:

1.0.4 (2011-12-21)

New:

Bug fix:

1.0.2 (2011-05-16)

New:

1.0.1 (2011-05-13)

New:

Bug fix:

1.0.0 (2010-08-22)

New:

  • First version of factory_boy

Credits

See :doc:`credits`.