From 4f357c52c4b2d611765865b39224fe3dfe22d926 Mon Sep 17 00:00:00 2001 From: Gladyston Franca Date: Thu, 17 Aug 2023 18:14:48 -0300 Subject: [PATCH] Adding interface to handle manual step execution. Manual step execution are meant to be executed outside runner domain. E.g Collecting user feedback through prompt. --- scripts/py_matter_yamltests/matter_yamltests/hooks.py | 6 ++++++ .../matter_yamltests/pseudo_clusters/pseudo_clusters.py | 4 ++++ scripts/py_matter_yamltests/matter_yamltests/runner.py | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/scripts/py_matter_yamltests/matter_yamltests/hooks.py b/scripts/py_matter_yamltests/matter_yamltests/hooks.py index c1b1fa53446ab5..575a05d95871ad 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/hooks.py +++ b/scripts/py_matter_yamltests/matter_yamltests/hooks.py @@ -207,6 +207,12 @@ def step_unknown(self): """ pass + async def step_manual(self): + """ + This method is called when the step is executed manually. + """ + pass + class WebSocketRunnerHooks(): def connecting(self, url: str): diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py index 7ab24f086442a9..ef15b8a0ac1b71 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/pseudo_clusters.py @@ -31,6 +31,10 @@ def __init__(self, clusters: List[PseudoCluster]): def supports(self, request) -> bool: return False if self.__get_command(request) is None else True + def is_manual_step(self, request): + return (request.cluster == LogCommands().name and + request.command == "UserPrompt") + def add(self, cluster: PseudoCluster): self.clusters.append(cluster) diff --git a/scripts/py_matter_yamltests/matter_yamltests/runner.py b/scripts/py_matter_yamltests/matter_yamltests/runner.py index 472d3cd8fa8203..25ba0ffcebb248 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/runner.py +++ b/scripts/py_matter_yamltests/matter_yamltests/runner.py @@ -182,6 +182,10 @@ async def _run(self, parser: TestParser, config: TestRunnerConfig): hooks.step_start(request) hooks.step_unknown() continue + elif config.pseudo_clusters.is_manual_step(request): + hooks.step_start(request) + await hooks.step_manual() + continue else: hooks.step_start(request)