summaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-03-11 22:07:23 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-03-11 22:11:35 +0100
commitba1fd987dad9268a1e5a41fe10513727aadfd9b5 (patch)
tree742dde52873162fd1a8fb213e1c37e2f14a9aa17 /factory
parent91592efbdff6de4b21b3a0b1a4d86dff8818f580 (diff)
downloadfactory-boy-ba1fd987dad9268a1e5a41fe10513727aadfd9b5.tar
factory-boy-ba1fd987dad9268a1e5a41fe10513727aadfd9b5.tar.gz
Add FACTORY_CLASS kwarg to make_factory and friends.
Diffstat (limited to 'factory')
-rw-r--r--factory/base.py4
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