Add test for dual class/factory inheritance.

If it works properly, this would make pylint happy.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Rewrite the whole documentation.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Add a Makefile.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Improve testing helpers.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Improve Iterator and SubFactory declarations.

* Iterator now cycles by default
* Iterator can be provided with a custom getter
* SubFactory accepts a factory import path as well

Deprecates:
* InfiniteIterator
* CircularSubFactory

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Tests: move disable_warnings to its own class.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Tests: improve deprecation warning detection in test_base.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Deprecate the extract_prefix option to PostGeneration.

Introduces a new, call-less syntax for the @post_generation decorator.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Improve coverage.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Get rid of the FACTORY_ABSTRACT rename.

This was just adding noise to an already complex release.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Update ChangeLog for 1.3.0

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Tests: run tox tests with warnings enabled.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Improve links in README.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
doc: Add recipe for SelfAttribute('..X').

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Allow symbol names in RelatedFactory (Closes #30).

This works exactly as for SubFactory.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Add a 'after post_generation' hook to Factory.

Use it in DjangoModelFactory to save objects again if a post_generation hook ran.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Use extracted argument in PostGenerationMethodCall.

This changeset makes it possible possible to override the default method
arguments (or "method_args") passed in when instantiating
PostGenerationMethodCall. Now the user can override the default
arguments to the method called during post-generation when instantiating
a factory.

For example, using this UserFactory,

    class UserFactory(factory.Factory):
        FACTORY_FOR = User

        username = factory.Sequence(lambda n: 'user{0}'.format(n))
        password = factory.PostGenerationMethodCall(
                'set_password', None, 'defaultpassword')

by default, the user will have a password set to 'defaultpassword', but
this can be overridden by passing in a new password as a keyword
argument:

    >>> u = UserFactory()
    >>> u.check_password('defaultpassword')
    True
    >>> other_u = UserFactory(password='different')
    >>> other_u.check_password('defaultpassword')
    False
    >>> other_u.check_password('different')
    True

This changeset introduces a testing dependency on the Mock package
http://pypi.python.org/pypi/mock. While this is a third-party dependency
in Python 2, it is part of the Python 3 standard library, as unit.mock,
and so a reasonable dependency to satisfy.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Let mock source be chosen by Python major version.

This should provide better Python 3 compatibility, since mock is in the
Python 3 standard library as unittest.mock.

Conflicts:

	tests/test_declarations.py

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Cleanup argument extraction in PostGenMethod (See #36).

This provides a consistent behaviour for extracting arguments to
a PostGenerationMethodCall.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Improve doc on post-generation hooks (Closes #36).

This was the last missing bit from PR#36 by @gotgenes.

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>