Skip to content

Commit 8d30071

Browse files
cecilletehampson
andauthored
Python testing: Fix skip_ to use test plan numbers (project-chip#32130)
* Python testing: Fix skip_ to use test plan numbers * Update src/python_testing/matter_testing_support.py Co-authored-by: Terence Hampson <thampson@google.com> * address review comments * Update src/python_testing/matter_testing_support.py Co-authored-by: Terence Hampson <thampson@google.com> --------- Co-authored-by: Terence Hampson <thampson@google.com>
1 parent 93f2282 commit 8d30071

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/python_testing/matter_testing_support.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -1014,16 +1014,24 @@ def skip_step(self, step):
10141014
self.step(step)
10151015
self.mark_current_step_skipped()
10161016

1017-
def skip_all_remaining_steps(self, starting_step):
1017+
def skip_all_remaining_steps(self, starting_step_number):
10181018
''' Skips all remaining test steps starting with provided starting step
10191019
1020-
starting_step must be provided, and is not derived intentionally. By providing argument
1020+
starting_step_number gives the first step to be skipped, as defined in the TestStep.test_plan_number
1021+
starting_step_number must be provided, and is not derived intentionally. By providing argument
10211022
test is more deliberately identifying where test skips are starting from, making
10221023
it easier to validate against the test plan for correctness.
10231024
'''
1024-
last_step = len(self.get_test_steps(self.current_test_info.name)) + 1
1025-
for index in range(starting_step, last_step):
1026-
self.skip_step(index)
1025+
steps = self.get_test_steps(self.current_test_info.name)
1026+
for idx, step in enumerate(steps):
1027+
if step.test_plan_number == starting_step_number:
1028+
starting_step_idx = idx
1029+
break
1030+
else:
1031+
asserts.fail("skip_all_remaining_steps was provided with invalid starting_step_num")
1032+
remaining = steps[starting_step_idx:]
1033+
for step in remaining:
1034+
self.skip_step(step.test_plan_number)
10271035

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

0 commit comments

Comments
 (0)