factory_boy
factory_boy copied to clipboard
Allow breaking circular imports with a lambda
The option to have factory references for related or sub-factories be strings is great, but breaks down if the referenced factory is anything other than a class defined at the top-level of a module - for example, I'm doing some stuff that dynamically defines factory classes and returns them from functions, which I'd like to be able to reference dynamically. This adds support to FactoryWrapper for related factories being callables, in addition to direct classes and strings.
@glittershark maybe add some tests showing how it works. You may also add some documentation for the feature