@@ -171,35 +171,40 @@ def load_from_module(self, module):
171171 return []
172172
173173 self ._set_defaults (registry )
174- candidates = registry .instantiate_all () if registry else []
175- legacy_candidates = legacy_registry () if legacy_registry else []
176- if self ._external_vars and legacy_candidates :
174+ test_pool = registry .instantiate_all () if registry else []
175+ legacy_tests = legacy_registry () if legacy_registry else []
176+ if self ._external_vars and legacy_tests :
177177 getlogger ().warning (
178178 "variables of tests using the deprecated "
179179 "'@parameterized_test' decorator cannot be set externally; "
180180 "please use the 'parameter' builtin in your tests"
181181 )
182182
183183 # Merge registries
184- candidates += legacy_candidates
184+ test_pool += legacy_tests
185185
186- # Serialize the fixture registries doing a level-order traversal
186+ # Do a level-order traversal of the fixture registries of all tests in
187+ # the test pool, instantiate all fixtures and generate the final set
188+ # of candidate tests to load; the test pool is consumed at the end of
189+ # the traversal and all instantiated tests (including fixtures) are
190+ # stored in `candidate_tests`.
187191 candidate_tests = []
188192 fixture_registry = FixtureRegistry ()
189- while candidates :
193+ while test_pool :
190194 tmp_registry = FixtureRegistry ()
191- while candidates :
192- c = candidates .pop ()
195+ while test_pool :
196+ c = test_pool .pop ()
193197 reg = getattr (c , '_rfm_fixture_registry' , None )
194198 candidate_tests .append (c )
195199 if reg :
196200 tmp_registry .update (reg )
197201
198202 # Instantiate the new fixtures and update the registry
199203 new_fixtures = tmp_registry .difference (fixture_registry )
200- candidates = new_fixtures .instantiate_all ()
204+ test_pool = new_fixtures .instantiate_all ()
201205 fixture_registry .update (new_fixtures )
202206
207+ # Post-instantiation validation of the candidate tests
203208 tests = []
204209 for c in candidate_tests :
205210 if not isinstance (c , RegressionTest ):
0 commit comments