Skip to content

Commit

Permalink
feat(executor_tree.py): trigger new method `SetupExecutor.update_inne…
Browse files Browse the repository at this point in the history
…r_referenced_feature_instances()` in `ExecutorTree._prepare_execution()` for all existing setups
  • Loading branch information
matosys committed Jun 27, 2024
1 parent 30a9c22 commit 7e3be7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/_balder/executor/executor_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def parent_executor(self) -> None:
# ---------------------------------- PROTECTED METHODS -------------------------------------------------------------

def _prepare_execution(self, show_discarded):
pass
if not show_discarded:
self.update_inner_feature_reference_in_all_setups()

def _body_execution(self, show_discarded):
for cur_setup_executor in self.get_setup_executors():
Expand Down Expand Up @@ -140,6 +141,16 @@ def cleanup_empty_executor_branches(self, consider_discarded=False):
for cur_setup_executor in to_remove_executor:
self._setup_executors.remove(cur_setup_executor)

def update_inner_feature_reference_in_all_setups(self):
"""
This method iterates over all setups and triggers the method that updates the inner feature references.
This needs to be done on ExecutorTree level, because this reference should also be accessible within session
fixtures (in case they have setup scope).
"""
for cur_setup_executor in self.get_setup_executors():
cur_setup_executor.update_inner_referenced_feature_instances()

def execute(self, show_discarded=False) -> None:
"""
This method executes this branch of the tree
Expand Down
2 changes: 0 additions & 2 deletions src/_balder/executor/setup_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def fixture_manager(self) -> FixtureManager:

def _prepare_execution(self, show_discarded):
print(f"SETUP {self.base_setup_class.__class__.__name__}")
if not show_discarded:
self.update_inner_referenced_feature_instances()

def _body_execution(self, show_discarded):
for cur_scenario_executor in self.get_scenario_executors():
Expand Down

0 comments on commit 7e3be7d

Please sign in to comment.