Skip to content

Commit 820cc30

Browse files
committed
get rid of on_enter hook and do the logic in the action instead
1 parent 6e95ddf commit 820cc30

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

render_machine/actions/prepare_testing_environment.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ class PrepareTestingEnvironment(BaseAction):
1212
FAILED_OUTCOME = "testing_environment_preparation_failed"
1313

1414
def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
15+
if (
16+
render_context.prepare_environment_script is None
17+
or not render_context.conformance_tests_running_context.should_prepare_testing_environment
18+
):
19+
return self.SUCCESSFUL_OUTCOME, None
20+
1521
console.info(
1622
f"Running testing environment preparation script {render_context.prepare_environment_script} for build folder {render_context.build_folder}."
1723
)

render_machine/render_context.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,6 @@ def start_refactoring_code(self):
310310
)
311311
self.machine.dispatch(triggers.PROCEED_FRID_PROCESSING)
312312

313-
def start_testing_environment_preparation(self):
314-
if (
315-
self.prepare_environment_script is None
316-
or not self.conformance_tests_running_context.should_prepare_testing_environment
317-
):
318-
self.machine.dispatch(triggers.MARK_TESTING_ENVIRONMENT_PREPARED)
319-
320313
def start_conformance_tests_processing(self):
321314
console.info("Implementing conformance tests...")
322315
current_frid_specifications, _ = plain_spec.get_specifications_for_frid(
@@ -534,7 +527,6 @@ def _handle_regression_testing(self):
534527

535528
self.machine.dispatch(triggers.MARK_CONFORMANCE_TESTS_READY)
536529

537-
# TODO why is this in the context and not part of the state machine (in an action)
538530
# ========== Main Conformance Test Orchestration ==========
539531

540532
def start_conformance_tests_for_frid(self):

render_machine/state_machine_config.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ def get_processing_conformance_tests_states(self, render_context: RenderContext)
133133
"name": States.CONFORMANCE_TESTING_INITIALISED.value,
134134
"on_enter": render_context.start_conformance_tests_for_frid,
135135
},
136-
{
137-
"name": States.CONFORMANCE_TEST_GENERATED.value,
138-
"on_enter": render_context.start_testing_environment_preparation,
139-
},
136+
States.CONFORMANCE_TEST_GENERATED.value,
140137
States.CONFORMANCE_TEST_ENV_PREPARED.value,
141138
{
142139
"name": States.CONFORMANCE_TEST_FAILED.value,

0 commit comments

Comments
 (0)