aboutsummaryrefslogtreecommitdiff
path: root/factory
Commit message (Collapse)AuthorAge
* factory: LazyFunction to just call a function in the simplest caseHervé Cauwelier2016-02-12
| | | | No need to wrap it in a lambda to strip the object argument from LazyAttribute or the sequence argument from Sequence.
* Release v2.6.1v2.6.12.6.1Raphaël Barrois2016-02-10
|
* Merge pull request #129 from anentropic/masterRaphaël Barrois2016-02-09
|\ | | | | Make safe repr more safe
| * Update utils.pyanentropic2014-03-13
| |
| * Make safe repr more safeanentropic2014-02-03
| |
* | fuzzy: Fix decimal.FloatOperation warning (Closes #261)Raphaël Barrois2016-02-10
| | | | | | | | | | | | | | | | | | | | | | | | Under Python 2.7+, the previous versions was directly casting fuzzy Decimal values into a float, which led to warnings in code trying to avoid such conversions in its tested code. Since we're just building random values, that behavior led to false positives or required jumping through weird hoops whenever a FuzzyDecimal was used. We now go trough a ``str()`` call to avoid such warnings.
* | optional forced flush on SQLAlchemyModelFactoryAlejandro2016-01-07
| | | | | | | | fixes rbarrois/factory_boy#81
* | mogo: Stop using .new, continued.Raphaël Barrois2015-10-21
| | | | | | | | | | | | From dc7d02095fff, spotted by @federicobond too. See #219.
* | Release v2.6.0v2.6.0Raphaël Barrois2015-10-20
| |
* | mogo: Stop using deprecated .new (Closes #219)Raphaël Barrois2015-10-20
| | | | | | | | | | | | This method has been deprecated in `mogo.model.Model` since 2012. Thanks to @federicobond for spotting this!
* | Lazy load django's get_model (Closes #228).Raphaël Barrois2015-10-20
| | | | | | | | | | | | 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).
* | add a way to add custom providers to FakerIonuț Arțăriși2015-10-20
| | | | | | | | | | | | | | | | | | | | | | factory_boy wraps faker and it stores Faker generators in a 'private' _FAKER_REGISTRY class attribute dict. There needs to be a way to extend the Faker generators with additional custom providers (without having to access _FAKER_REGISTRY directly). This commit adds a (factory_boy) Faker.add_provider class method which calls Faker's own `add_provider` method on internally stored (via _FAKER_REGISTRY) Faker generators.
* | Improve debug logging efficiency (Closes #155).Raphaël Barrois2015-07-11
| | | | | | | | | | As suggested by @adamchainz, use lazy computation of args/kwargs pprint to only perform complex computation when running with debug.
* | Improve @coagulant's fixes to django signals (Closes #212).Raphaël Barrois2015-07-05
| | | | | | | | Signal caching didn't exist until Django 1.6.
* | Fix mute_signals behavior for signals with cachingIlya Baryshev2015-07-05
| | | | | | | | | | | | | | | | | | 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
* | Improve ORM layer import paths (Closes #186).Raphaël Barrois2015-05-31
| | | | | | | | | | | | | | | | | | You may now use the following code: import factory factory.alchemy.SQLAlchemyModelFactory factory.django.DjangoModelFactory factory.mongoengine.MongoEngineFactory
* | Properly handle custom Django managers (Closes #201).Raphaël Barrois2015-05-31
| | | | | | | | | | | | 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.
* | Add lazy loading to factory.Iterator.Raphaël Barrois2015-05-24
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Add factory.Faker()Raphaël Barrois2015-05-22
| | | | | | | | | | This relies on the ``fake-factory`` library, and provides realistic random values for most field types.
* | Add Meta.rename to handle name conflicts (See #206).Raphaël Barrois2015-05-20
| | | | | | | | | | | | 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.
* | Release v2.5.2v2.5.2Raphaël Barrois2015-04-21
| |
* | Remove warnings with Django 1.7 (Closes #195).Raphaël Barrois2015-04-14
| | | | | | | | | | | | | | Builds upon pull request by @shinuza: - Properly import ``get_model`` - Run ``django.setup()`` before importing any models.
* | Release v2.5.1v2.5.1Raphaël Barrois2015-03-27
| |
* | Support declarations in FileField/ImageField.Raphaël Barrois2015-03-27
| | | | | | | | Previously, the declarations (``factory.Sequence`` & co) weren't properly computed.
* | Respect default manager in DjangoModelFactory (Closes #192).Raphaël Barrois2015-03-27
| | | | | | | | | | The previous version tries to use ``cls._default_manager`` all the time, which breaks with ``manager.using(db_name)``.
* | Remove debug printsRaphaël Barrois2015-03-27
| |
* | Update header years.Raphaël Barrois2015-03-26
| |
* | Release v2.5.0v2.5.0Raphaël Barrois2015-03-26
| |
* | Turn FileField/ImageField into normal fields (Closes #141).Raphaël Barrois2015-03-26
| | | | | | | | | | Previously, they ran as post_generation hooks, meaning that they couldn't be checked in a model's ``save()`` method, for instance.
* | Remove limitations of factory.StubFactory (Closes #131).Raphaël Barrois2015-03-26
| | | | | | | | | | ``StubFactory.build()`` is now supported, and maps to ``StubFactory.stub()``.
* | Add support for multidb with Django (Closes #171).Raphaël Barrois2015-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ``factory.django.DjangoModelFactory`` now takes an extra option: ``` class MyFactory(factory.django.DjangoModelFactory): class Meta: model = models.MyModel database = 'replica' ``` This will create all instances of ``models.Model`` in the ``'replica'`` database.
* | Fix issues between mute_signals() and factory inheritance (Closes #183).Raphaël Barrois2015-03-26
| | | | | | | | | | | | Previously, if a factory was decorated with ``@mute_signals`` and one of its descendant called another one of its descendant, signals weren't unmuted properly.
* | Allow lazy evaluation of FuzzyChoice's iterators (Closes #184).Raphaël Barrois2015-03-26
| | | | | | | | | | | | | | | | | | This allows the following idiom: ``user = factory.fuzzy.FuzzyChoice(User.objects.all())`` Previously, the ``User.objects.all()`` queryset would have been evaluated *at import time*; it is now evaluated with the first use of the ``FuzzyChoice``.
* | Fix typo in FuzzyDateTime (Closes #189).Raphaël Barrois2015-03-26
| | | | | | | | Thanks to @shinuza for spotting this!
* | Logs: Allow non-integer sequences (Closes #148).Raphaël Barrois2015-03-03
| | | | | | | | As pointed by @glinmac.
* | Fix bad default value for Factory.declarations (Closes #162).Raphaël Barrois2015-03-03
| |
* | Enable resetting factory.fuzzy's random generator (Closes #175, #185).Raphaël Barrois2015-02-18
| | | | | | | | | | | | | | | | | | Users may now call ``factory.fuzzy.get_random_state()`` to retrieve the current random generator's state (isolated from the one used in Python's ``random``). That state can then be reinjected with ``factory.fuzzy.set_random_state(state)``.
* | Remove deprecated features.Raphaël Barrois2014-11-18
| | | | | | | | | | This disables the ``FACTORY_FOR`` syntax and related parameters, that should be declared through ``class Meta``.
* | Remove automagic pk-based sequence setupRaphaël Barrois2014-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to issues #78, #92, #103, #111, #153, #170 The default value of all sequences is now 0; the automagic ``_setup_next_sequence`` behavior of Django/SQLAlchemy has been removed. This feature's only goal was to allow the following scenario: 1. Run a Python script that uses MyFactory.create() a couple of times (with a unique field based on the sequence counter) 2. Run the same Python script a second time Without the magical ``_setup_next_sequence``, the Sequence counter would be set to 0 at the beginning of each script run, so both runs would generate objects with the same values for the unique field ; thus conflicting and crashing. The above behavior having only a very limited use and bringing various issues (hitting the database on ``build()``, problems with non-integer or composite primary key columns, ...), it has been removed. It could still be emulated through custom ``_setup_next_sequence`` methods, or by calling ``MyFactory.reset_sequence()``.
* | Release v2.4.1v2.4.12.4.1Raphaël Barrois2014-06-23
| |
* | Fix declaration inheritance.Raphaël Barrois2014-06-23
| |
* | Release v2.4.0v2.4.0Raphaël Barrois2014-06-21
| |
* | Provide readable errors when Meta.model isn't set (Closes #137).Raphaël Barrois2014-06-21
| |
* | Rename hidden/arg_parameters to exclude/inline_args.Raphaël Barrois2014-05-18
| |
* | Rename 'target' to 'model'.Raphaël Barrois2014-05-18
| |
* | Add DeprecationWarning for FACTORY_* kwargsRaphaël Barrois2014-05-18
| |
* | Remove containers.DeclarationsDict.Raphaël Barrois2014-05-18
| | | | | | | | Now replaced with a simple dict.
* | Switch tests to class Meta.Raphaël Barrois2014-05-18
| |
* | Migrate factory.alchemy to class MetaRaphaël Barrois2014-05-18
| |
* | factory.django: Fix counter inheritance with abstract models.Raphaël Barrois2014-05-18
| |