Skip to content

Commit

Permalink
Python testing: Fix skip_ to use test plan numbers (project-chip#32130)
Browse files Browse the repository at this point in the history
* Python testing: Fix skip_ to use test plan numbers

* Update src/python_testing/matter_testing_support.py

Co-authored-by: Terence Hampson <[email protected]>

* address review comments

* Update src/python_testing/matter_testing_support.py

Co-authored-by: Terence Hampson <[email protected]>

---------

Co-authored-by: Terence Hampson <[email protected]>
  • Loading branch information
cecille and tehampson authored Feb 15, 2024
1 parent 93f2282 commit 8d30071
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/python_testing/matter_testing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,16 +1014,24 @@ def skip_step(self, step):
self.step(step)
self.mark_current_step_skipped()

def skip_all_remaining_steps(self, starting_step):
def skip_all_remaining_steps(self, starting_step_number):
''' Skips all remaining test steps starting with provided starting step
starting_step must be provided, and is not derived intentionally. By providing argument
starting_step_number gives the first step to be skipped, as defined in the TestStep.test_plan_number
starting_step_number must be provided, and is not derived intentionally. By providing argument
test is more deliberately identifying where test skips are starting from, making
it easier to validate against the test plan for correctness.
'''
last_step = len(self.get_test_steps(self.current_test_info.name)) + 1
for index in range(starting_step, last_step):
self.skip_step(index)
steps = self.get_test_steps(self.current_test_info.name)
for idx, step in enumerate(steps):
if step.test_plan_number == starting_step_number:
starting_step_idx = idx
break
else:
asserts.fail("skip_all_remaining_steps was provided with invalid starting_step_num")
remaining = steps[starting_step_idx:]
for step in remaining:
self.skip_step(step.test_plan_number)

def step(self, step: typing.Union[int, str]):
test_name = self.current_test_info.name
Expand Down

0 comments on commit 8d30071

Please sign in to comment.