| Commit message (Collapse) | Author | Age |
|\
| |
| |
| | |
Release of factory_boy 2.7.0
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add documentation on how to use a LazyAttribute in a SubFactory and poke
the "factory_parent" attribute to indirectly derive the value of a field
on the child factory from a field on the parent factory. This commit adds
an example to recipes that explains how it can be done. It also adds a
test to make sure that this feature continues to work as is now described
in the documentation.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Based on a boolean flag, those will alter the definitions of the current
factory, taking precedence over pre-defined behavior but overridden by
callsite-level arguments.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This handles parameters that alter the declarations of a factory.
A few technical notes:
- A parameter's outcome may alter other parameters
- In order to fix that, we perform a (simple) cyclic definition
detection at class declaration time.
- Parameters may only be either naked values or ComplexParameter
subclasses
- Parameters are never passed to the underlying class
|
| |
| |
| |
| |
| |
| |
| | |
That section described code required when factory_boy was automagically
computing sequence numbers from the current PK value.
Closes #280
|
| |
| |
| |
| | |
This trick should help with #68.
|
| |
| |
| |
| |
| |
| | |
Full discussion in https://github.com/rbarrois/factory_boy/issues/271
Wanted to get something mentioned in the docs immediately.
|
| |\
| | |
| | | |
Clarify sequence behavior on inheritance
|
| | |
| | |
| | | |
Sequences are only shared via inheritance if the model of the subclass is the same as or a subclass of the model of the parent class. Clarify the docs on this point.
|
| |\ \
| | | |
| | | | |
factory: LazyFunction to just call a function in the simplest case
|
| | | |
| | | |
| | | |
| | | | |
No need to wrap it in a lambda to strip the object argument from LazyAttribute or the sequence argument from Sequence.
|
| |/ / |
|
| | | |
|
|\| |
| | |
| | |
| | | |
Release of factory_boy 2.6.1
|
| |\ \
| | | |
| | | | |
Fixed spelling of word "independent".
|
| | |/ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When both ``from_file`` and ``filename`` are provided, ``filename``
takes precedence.
Thanks to @darkowic for spotting this :)
|
| | | |
|
| | | |
|
| |/
| |
| |
| | |
fixes rbarrois/factory_boy#81
|
| |
| |
| |
| | |
Thanks a lot to Jeff Widman for spotting them!
|
| | |
|
| |
| |
| |
| | |
Closes #140, as this won't be implemented in the next few weeks.
|
| |
| |
| |
| |
| |
| |
| | |
This note was added to document a regression in Django 1.8.0; the
regression has been fixed in 1.8.4.
Closes #232
|
| |
| |
| |
| |
| |
| | |
This method has been deprecated in `mogo.model.Model` since 2012.
Thanks to @federicobond for spotting this!
|
| |
| |
| |
| | |
As spotted by @stephane, thanks!
|
| |
| |
| |
| |
| |
| | |
Loading this function will, on pre-1.8 versions, load Django settings.
We'll lazy-load it to avoid crashes when Django hasn't been configured
yet (e.g in auto-discovery test setups).
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Connecting signals (with use_caching=True) inside mute_signals
was breaking unmute on exit. Paused receivers were not running.
This was caused by signal cache not being restored after unpatching.
Workaround is to clear signal cache on exit.
Fixes #212
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
You may now use the following code:
import factory
factory.alchemy.SQLAlchemyModelFactory
factory.django.DjangoModelFactory
factory.mongoengine.MongoEngineFactory
|
| |
| |
| |
| |
| |
| | |
The actual behavior of Django with custom managers and inherited
abstract models is rather complex, so this had to be adapted to the
actual Django source code.
|
| |
| |
| |
| | |
As spotted by @proofit404
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
factory.Iterator no longers begins iteration of its argument
on declaration, since this behavior may trigger database query
when that argument is, for instance, a Django queryset.
The ``factory.Iterator``'s argument will only be called when
the containing ``Factory`` is first evaluated; this means that
factories using ``factory.Iterator(models.MyThingy.objects.all())``
will no longer call the database at import time.
|
| |
| |
| |
| |
| | |
This relies on the ``fake-factory`` library, and provides realistic
random values for most field types.
|
| |
| |
| |
| | |
Thanks to @nikolas for spotting it!
|
| |
| |
| |
| |
| |
| | |
Define ``Meta.rename = {'attrs': 'attributes'}``
if your model expects a ``attributes`` kwarg but you can't
define it since it's already reserved by the ``Factory`` class.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
From 1.8 onwards, this crashes:
>>> a = MyModel() # Don't save
>>> b = MyOtherModel(fkey_to_mymodel=a)
In turn, it breaks:
class MyModelFactory(factory.django.DjangoModelFactory):
class Meta:
model = MyModel
class MyOtherModelFactory(factory.django.DjangoModelFactory):
class Meta:
model = MyOtherModel
fkey_to_mymodel = factory.SubFactory(MyModelFactory)
MyOtherModelFactory.build() # Breaks
The error message is: Cannot assign "MyModel()": "MyModel" instance isn't saved in the database.
See https://code.djangoproject.com/ticket/10811 for details.
|
| | |
|
| |
| |
| |
| | |
Thanks to @DasAllFolks for spotting it!
|
| | |
|
| |
| |
| |
| | |
Previously, the declarations (``factory.Sequence`` & co) weren't properly computed.
|
| |
| |
| |
| |
| | |
The previous version tries to use ``cls._default_manager`` all the time,
which breaks with ``manager.using(db_name)``.
|
| | |
|
| | |
|
| | |
|
| | |
|