Skip to content

Commit 7557e54

Browse files
Update test start hooks (#34140)
* Update test start hooks * Restyled by autopep8 --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 446ca8b commit 7557e54

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

scripts/py_matter_yamltests/matter_yamltests/hooks.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def stop(self, duration: int):
104104
"""
105105
pass
106106

107-
def test_start(self, filename: str, name: str, count: int):
107+
def test_start(self, filename: str, name: str, count: int, steps: list[str] = []):
108108
"""
109109
This method is called when the runner starts running a single test.
110110
@@ -118,6 +118,9 @@ def test_start(self, filename: str, name: str, count: int):
118118
119119
count: int
120120
The number of steps from the test that will be run.
121+
122+
steps: list[str]
123+
The computed test step names
121124
"""
122125
pass
123126

scripts/tests/chipyaml/tests_logger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def start(self, count: int):
161161
def stop(self, duration: int):
162162
print(self.__strings.stop.format(runned=self.__runned, skipped=self.__skipped, duration=duration))
163163

164-
def test_start(self, filename: str, name: str, count: int):
164+
def test_start(self, filename: str, name: str, count: int, steps: list[str] = []):
165165
print(self.__strings.test_start.format(name=click.style(name, bold=True), count=click.style(count, bold=True)))
166166

167167
if self.__use_test_harness_log_format:

src/python_testing/hello_external_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def start(self, count: int):
5959
def stop(self, duration: int):
6060
self.stop_called = True
6161

62-
def test_start(self, filename: str, name: str, count: int):
62+
def test_start(self, filename: str, name: str, count: int, steps: list[str] = []):
6363
self.test_start_called = True
6464

6565
def test_stop(self, exception: Exception, duration: int):

src/python_testing/matter_testing_support.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def start(self, count: int):
274274
def stop(self, duration: int):
275275
logging.info(f'Finished test set, ran for {duration}ms')
276276

277-
def test_start(self, filename: str, name: str, count: int):
277+
def test_start(self, filename: str, name: str, count: int, steps: list[str] = []):
278278
logging.info(f'Starting test from {filename}: {name} - {count} steps')
279279

280280
def test_stop(self, exception: Exception, duration: int):
@@ -740,7 +740,8 @@ def setup_test(self):
740740
num_steps = 1 if steps is None else len(steps)
741741
filename = inspect.getfile(self.__class__)
742742
desc = self.get_test_desc(test_name)
743-
self.runner_hook.test_start(filename=filename, name=desc, count=num_steps)
743+
steps_descriptions = [] if steps is None else [step.description for step in steps]
744+
self.runner_hook.test_start(filename=filename, name=desc, count=num_steps, steps=steps_descriptions)
744745
# If we don't have defined steps, we're going to start the one and only step now
745746
# if there are steps defined by the test, rely on the test calling the step() function
746747
# to indicates how it is proceeding

0 commit comments

Comments
 (0)