From 200ae7525a985c5e281dc6699f9e74d539900739 Mon Sep 17 00:00:00 2001 From: Nicholas Cilfone Date: Tue, 1 Feb 2022 15:21:02 -0500 Subject: [PATCH] resolves bug in lazy search where duplicated classes would occur --- spock/graph.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spock/graph.py b/spock/graph.py index 632da917..fda7c250 100644 --- a/spock/graph.py +++ b/spock/graph.py @@ -110,7 +110,10 @@ def _lazily_find_classes(self, classes): # Iterate thorough all of the base spock classes to get the dependencies and reverse dependencies lazy_classes = [] for _, v in self._yield_class_deps(classes): - if hasattr(sys.modules["spock"].backend.config, v): + if ( + hasattr(sys.modules["spock"].backend.config, v) + and getattr(sys.modules["spock"].backend.config, v) not in classes + ): print( f"Lazy evaluation found a @spock decorated class named `{v}` within the registered types of " f"sys.modules['spock'].backend.config -- Attempting to use the class "