Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TC-SWTCH - add top level PICS gating for TH #35918

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/python_testing/TC_SWTCH.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ def steps_TC_SWTCH_2_2(self):
"Verify that the value is 0, and that a subscription report was received for that change."),
]

def pics_TC_SWTCH_2_2(self) -> list[str]:
return [
"SWTCH.S",
"SWTCH.S.F00"
]

@run_if_endpoint_matches(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kLatchingSwitch))
async def test_TC_SWTCH_2_2(self):
post_prompt_settle_delay_seconds = 10.0
Expand Down Expand Up @@ -410,6 +416,12 @@ def steps_TC_SWTCH_2_3(self):
TestStep(9, "TH reads the CurrentPosition attribute from the DUT", "Verify that the value is 0"),
]

def pics_TC_SWTCH_2_3(self) -> list[str]:
return [
"SWTCH.S",
"SWTCH.S.F01"
]

@run_if_endpoint_matches(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch))
async def test_TC_SWTCH_2_3(self):
# Commissioning - already done
Expand Down Expand Up @@ -488,6 +500,12 @@ def steps_TC_SWTCH_2_4(self):
""")
]

def pics_TC_SWTCH_2_4(self) -> list[str]:
return [
"SWTCH.S",
"SWTCH.S.F01"
]

@run_if_endpoint_matches(has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitch))
async def test_TC_SWTCH_2_4(self):
switch_pressed_position = self._default_pressed_position
Expand Down Expand Up @@ -656,6 +674,12 @@ def steps_TC_SWTCH_2_5(self):

]

def pics_TC_SWTCH_2_5(self) -> list[str]:
return [
"SWTCH.S",
"SWTCH.S.F04"
]

@staticmethod
def should_run_SWTCH_2_5(wildcard, endpoint):
msm = has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitchMultiPress)
Expand Down Expand Up @@ -835,6 +859,13 @@ def steps_TC_SWTCH_2_6(self):
"Verify that the TH receives MultiPressComplete event with PreviousPosition set to 1 and TotalNumberOfPressesCounted set to 1 from the DUT"),
]

def pics_TC_SWTCH_2_6(self) -> list[str]:
return [
"SWTCH.S",
"SWTCH.S.F04",
"SWTCH.S.F05"
]

@staticmethod
def should_run_SWTCH_2_6(wildcard, endpoint):
msm = has_feature(Clusters.Switch, Clusters.Switch.Bitmaps.Feature.kMomentarySwitchMultiPress)
Expand Down
5 changes: 3 additions & 2 deletions src/python_testing/matter_testing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -2171,8 +2171,9 @@ def run_if_endpoint_matches(accept_function: EndpointCheckFunction):
"""
def run_if_endpoint_matches_internal(body):
def per_endpoint_runner(self: MatterBaseTest, *args, **kwargs):
asserts.assert_false(self.get_test_pics(self.current_test_info.name),
"pics_ method supplied for run_if_endpoint_matches.")
# Disabling this for now so the TH does not need to spend the time to run these tests. We can PICS-gate these and re-evaluate in 1.5
# asserts.assert_false(self.get_test_pics(self.current_test_info.name),
# "pics_ method supplied for run_if_endpoint_matches.")
runner_with_timeout = asyncio.wait_for(should_run_test_on_endpoint(self, accept_function), timeout=60)
should_run_test = asyncio.run(runner_with_timeout)
if not should_run_test:
Expand Down
11 changes: 6 additions & 5 deletions src/python_testing/test_testing/TestDecorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,12 @@ def main():
if not ok:
failures.append("Test case failure: test_endpoints")

test_name = 'test_endpoint_with_pics'
test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name)
ok = test_runner.run_test_with_mock_read(read_resp, hooks)
if ok:
failures.append(f"Did not get expected test assertion on {test_name}")
# Disabling this for now - in 1.4 we will allow self-selecting tests that are also gated by PICS
# test_name = 'test_endpoint_with_pics'
# test_runner.set_test('TestDecorators.py', 'TestDecorators', test_name)
# ok = test_runner.run_test_with_mock_read(read_resp, hooks)
# if ok:
# failures.append(f"Did not get expected test assertion on {test_name}")

# Test should run once for the whole node, regardless of the number of endpoints
def run_check(test_name: str, read_response: Attribute.AsyncReadTransaction.ReadResponse, expect_skip: bool) -> None:
Expand Down
Loading