Skip to content

Commit

Permalink
Update documentation and typing for request parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton36 committed May 31, 2023
1 parent 30d92f2 commit 20f90c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
15 changes: 8 additions & 7 deletions scripts/py_matter_yamltests/matter_yamltests/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

from .errors import TestStepError
from .parser import TestStep


class TestParserHooks():
Expand Down Expand Up @@ -143,18 +144,18 @@ def step_skipped(self, name: str, expression: str):
"""
pass

def step_start(self, request):
def step_start(self, request: TestStep):
"""
This method is called when the runner starts running a step from the test.
Parameters
----------
name: str
The name of the test step that is starting.
request: TestStep
The original request as defined by the test step.
"""
pass

def step_success(self, logger, logs, duration: int, request):
def step_success(self, logger, logs, duration: int, request: TestStep):
"""
This method is called when running a step succeeds.
Expand All @@ -169,12 +170,12 @@ def step_success(self, logger, logs, duration: int, request):
duration: int
How long it took to run the test step, in milliseconds.
request:
request: TestStep
The original request as defined by the test step.
"""
pass

def step_failure(self, logger, logs, duration: int, request, received):
def step_failure(self, logger, logs, duration: int, request: TestStep, received):
"""
This method is called when running a step fails.
Expand All @@ -189,7 +190,7 @@ def step_failure(self, logger, logs, duration: int, request, received):
duration: int
How long it took to run the test step, in milliseconds.
request:
request: TestStep
The original request as defined by the test step.
received:
Expand Down
7 changes: 4 additions & 3 deletions scripts/tests/yaml/tests_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import click
from matter_yamltests.errors import TestStepError, TestStepKeyError
from matter_yamltests.hooks import TestParserHooks, TestRunnerHooks, WebSocketRunnerHooks
from matter_yamltests.parser import TestStep


def _strikethrough(str):
Expand Down Expand Up @@ -193,7 +194,7 @@ def step_skipped(self, name: str, expression: str):
self.__index += 1
self.__skipped += 1

def step_start(self, request):
def step_start(self, request: TestStep):
if self.__use_test_harness_log_format:
print(self.__strings.test_harness_step_start.format(index=self.__index, name=request.label))

Expand All @@ -211,7 +212,7 @@ def step_unknown(self):

self.__runned += 1

def step_success(self, logger, logs, duration: int, request):
def step_success(self, logger, logs, duration: int, request: TestStep):
print(self.__strings.step_result.format(state=_SUCCESS, duration=duration))

self.__print_results(logger)
Expand All @@ -230,7 +231,7 @@ def step_success(self, logger, logs, duration: int, request):
self.__errors += logger.errors
self.__runned += 1

def step_failure(self, logger, logs, duration: int, request, received):
def step_failure(self, logger, logs, duration: int, request: TestStep, received):
print(self.__strings.step_result.format(state=_FAILURE, duration=duration))

self.__print_results(logger)
Expand Down

0 comments on commit 20f90c5

Please sign in to comment.