diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-11 22:07:23 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-11 22:11:35 +0100 |
commit | ba1fd987dad9268a1e5a41fe10513727aadfd9b5 (patch) | |
tree | 742dde52873162fd1a8fb213e1c37e2f14a9aa17 /factory/base.py | |
parent | 91592efbdff6de4b21b3a0b1a4d86dff8818f580 (diff) | |
download | factory-boy-ba1fd987dad9268a1e5a41fe10513727aadfd9b5.tar factory-boy-ba1fd987dad9268a1e5a41fe10513727aadfd9b5.tar.gz |
Add FACTORY_CLASS kwarg to make_factory and friends.
Diffstat (limited to 'factory/base.py')
-rw-r--r-- | factory/base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/factory/base.py b/factory/base.py index e798c68..a6ab98e 100644 --- a/factory/base.py +++ b/factory/base.py @@ -705,7 +705,9 @@ def make_factory(klass, **kwargs): """Create a new, simple factory for the given class.""" factory_name = '%sFactory' % klass.__name__ kwargs[FACTORY_CLASS_DECLARATION] = klass - factory_class = type(Factory).__new__(type(Factory), factory_name, (Factory,), kwargs) + base_class = kwargs.pop('FACTORY_CLASS', Factory) + + factory_class = type(Factory).__new__(type(Factory), factory_name, (base_class,), kwargs) factory_class.__name__ = '%sFactory' % klass.__name__ factory_class.__doc__ = 'Auto-generated factory for class %s' % klass return factory_class |