Skip to content

Commit 24d6304

Browse files
committed
get rid of on_enter hook and do the logic in the action instead
1 parent 96a033b commit 24d6304

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
@@ -325,13 +325,6 @@ def start_refactoring_code(self):
325325
)
326326
self.machine.dispatch(triggers.PROCEED_FRID_PROCESSING)
327327

328-
def start_testing_environment_preparation(self):
329-
if (
330-
self.prepare_environment_script is None
331-
or not self.conformance_tests_running_context.should_prepare_testing_environment
332-
):
333-
self.machine.dispatch(triggers.MARK_TESTING_ENVIRONMENT_PREPARED)
334-
335328
def start_conformance_tests_processing(self):
336329
console.info("Implementing conformance tests...")
337330
current_frid_specifications, _ = plain_spec.get_specifications_for_frid(
@@ -549,7 +542,6 @@ def _handle_regression_testing(self):
549542

550543
self.machine.dispatch(triggers.MARK_CONFORMANCE_TESTS_READY)
551544

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

555547
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
@@ -132,10 +132,7 @@ def get_processing_conformance_tests_states(self, render_context: RenderContext)
132132
"name": States.CONFORMANCE_TESTING_INITIALISED.value,
133133
"on_enter": render_context.start_conformance_tests_for_frid,
134134
},
135-
{
136-
"name": States.CONFORMANCE_TEST_GENERATED.value,
137-
"on_enter": render_context.start_testing_environment_preparation,
138-
},
135+
States.CONFORMANCE_TEST_GENERATED.value,
139136
States.CONFORMANCE_TEST_ENV_PREPARED.value,
140137
{
141138
"name": States.CONFORMANCE_TEST_FAILED.value,

0 commit comments

Comments
 (0)