From 6cad767ac1452408e5b350be60bc8c6c133a8a4a Mon Sep 17 00:00:00 2001 From: Charles-Axel Dein Date: Fri, 17 May 2019 10:23:47 +0200 Subject: [PATCH] Allow disabling factory deps --- pytest_factoryboy/fixture.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytest_factoryboy/fixture.py b/pytest_factoryboy/fixture.py index 7b4bdb5..d90ba64 100644 --- a/pytest_factoryboy/fixture.py +++ b/pytest_factoryboy/fixture.py @@ -17,6 +17,7 @@ from funcsigs import signature SEPARATOR = "__" +IS_SUBFACTORY_DEPS_ENABLED = True FIXTURE_FUNC_FORMAT = """ @@ -87,7 +88,8 @@ def register(factory_class, _name=None, **kwargs): else: value = kwargs.get(attr, value) - if isinstance(value, (factory.SubFactory, factory.RelatedFactory)): + if (IS_SUBFACTORY_DEPS_ENABLED + and isinstance(value, (factory.SubFactory, factory.RelatedFactory))): subfactory_class = value.get_factory() subfactory_deps = get_deps(subfactory_class, factory_class)