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

[Fix] Possible fix for matter-test-scripts issue #227: Remove PICS from OPSTATE tests #34290

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f106cea
Possible fix for matter-test-scripts issue #227:
j-ororke Jul 10, 2024
d10612e
Restyled by autopep8
restyled-commits Jul 10, 2024
832661a
Updated TC_OpstateCommon.py:
j-ororke Jul 10, 2024
80aa98b
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 10, 2024
9058317
Restyled by autopep8
restyled-commits Jul 10, 2024
53f6afb
Restyled by isort
restyled-commits Jul 10, 2024
e30aefa
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 11, 2024
084a115
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 11, 2024
3c2ba60
Resolving Linting issue in TC_RVCOPSTATE_2_1:
j-ororke Jul 11, 2024
ec31380
Updating TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 11, 2024
d734497
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 15, 2024
0e7e99a
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Jul 15, 2024
4f474ec
Restyled by autopep8
restyled-commits Jul 15, 2024
708cb59
Updated TC_OpstateCommon and TC_RVCOPSTATE_2_1:
j-ororke Jul 16, 2024
16afba8
Restyled by autopep8
restyled-commits Jul 16, 2024
830198f
Updated TC_OpstateCommon module:
j-ororke Jul 16, 2024
273f8d3
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
j-ororke Jul 18, 2024
f6f8b18
Updated TC_OpstateCommon and TC_RVCOPSTATE_2_1:
j-ororke Jul 19, 2024
8204e89
Restyled by autopep8
restyled-commits Jul 19, 2024
06d3727
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
j-ororke Sep 23, 2024
e9e5e43
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
j-ororke Sep 23, 2024
14d57ad
Updated matter_testing_support, OpstateCommon, and RVCOPSTATE_2_1 mod…
j-ororke Sep 23, 2024
7a72247
Restyled by autopep8
restyled-commits Sep 23, 2024
1f8af58
Restyled by isort
restyled-commits Sep 23, 2024
a441b26
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
j-ororke Sep 27, 2024
6b61a00
Updated TC_OpstateCommon.py:
j-ororke Sep 27, 2024
fd714b8
Merge branch 'master' into remove_PICS_from_OPSTATE_tests
j-ororke Sep 30, 2024
f090844
Updating method for attributes_guard functionality
j-ororke Sep 30, 2024
78f6e4e
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Sep 30, 2024
b972df9
Updating TC_RVCOPSTATE_2_1 test module:
j-ororke Oct 1, 2024
354f40a
Merge branch 'master' of github.com:project-chip/connectedhomeip into…
j-ororke Oct 22, 2024
c0adcba
Updated TC_OpstateCommon, TC_RVCOPSTATE_2_1, and matter_testing support:
j-ororke Oct 23, 2024
9aa1d04
Restyled by autopep8
restyled-commits Oct 23, 2024
bb54582
Updated TC_RVCOPSTATE_2_1 test module:
j-ororke Oct 23, 2024
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
Prev Previous commit
Next Next commit
Updated TC_OpstateCommon, TC_RVCOPSTATE_2_1, and matter_testing support:
- Resolved issues with attributes_guard function in matter_testing support module
  • Loading branch information
j-ororke committed Oct 23, 2024
commit c0adcbaeefd1b3791257c53b6c0104778246493f
34 changes: 17 additions & 17 deletions src/python_testing/TC_OpstateCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction
from chip.clusters.Types import NullValue
from chip.interaction_model import InteractionModelError, Status
from chip.testing.matter_testing import ClusterAttributeChangeAccumulator, EventChangeCallback, TestStep, has_attribute
from chip.testing.matter_testing import ClusterAttributeChangeAccumulator, EventChangeCallback, TestStep
from mobly import asserts


Expand Down Expand Up @@ -248,7 +248,7 @@ async def TEST_TC_OPSTATE_BASE_1_1(self, endpoint=1, cluster_revision=1, feature
attributes.ClusterRevision.attribute_id
]

if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
expected_value.append(attributes.CountdownTime.attribute_id)

await self.read_and_expect_array_contains(endpoint=endpoint,
Expand Down Expand Up @@ -347,7 +347,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):

# STEP 2: TH reads from the DUT the PhaseList attribute
self.step(2)
if self.attributes_guard(has_attribute(attributes.PhaseList)):
if self.attributes_guard(attributes.PhaseList):
phase_list = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.PhaseList)
if phase_list is not NullValue:
Expand All @@ -357,7 +357,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):

# STEP 3: TH reads from the DUT the CurrentPhase attribute
self.step(3)
if self.attributes_guard(has_attribute(attributes.CurrentPhase)):
if self.attributes_guard(attributes.CurrentPhase):
current_phase = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CurrentPhase)
if (phase_list == NullValue) or (not phase_list):
Expand All @@ -369,7 +369,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):

# STEP 4: TH reads from the DUT the CountdownTime attribute
self.step(4)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)
if countdown_time is not NullValue:
Expand All @@ -378,7 +378,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):

# STEP 5: TH reads from the DUT the OperationalStateList attribute
self.step(5)
if self.attributes_guard(has_attribute(attributes.OperationalStateList)):
if self.attributes_guard(attributes.OperationalStateList):
operational_state_list = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.OperationalStateList)
defined_states = [state.value for state in cluster.Enums.OperationalStateEnum
Expand Down Expand Up @@ -464,7 +464,7 @@ async def TEST_TC_OPSTATE_BASE_2_1(self, endpoint=1):

# STEP 7: TH reads from the DUT the OperationalError attribute
self.step(7)
if self.attributes_guard(has_attribute(attributes.OperationalError)):
if self.attributes_guard(attributes.OperationalError):
operational_error = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.OperationalError)
# Defined Errors
Expand Down Expand Up @@ -600,7 +600,7 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1):

# STEP 3: TH reads from the DUT the OperationalStateList attribute
self.step(3)
if self.attributes_guard(has_attribute(attributes.OperationalStateList)):
if self.attributes_guard(attributes.OperationalStateList):
operational_state_list = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.OperationalStateList)

Expand Down Expand Up @@ -628,15 +628,15 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1):

# STEP 6: TH reads from the DUT the OperationalError attribute
self.step(6)
if self.attributes_guard(has_attribute(attributes.OperationalError)):
if self.attributes_guard(attributes.OperationalError):
await self.read_and_expect_property_value(endpoint=endpoint,
attribute=attributes.OperationalError,
attr_property="errorStateID",
expected_value=cluster.Enums.ErrorStateEnum.kNoError)

# STEP 7: TH reads from the DUT the CountdownTime attribute
self.step(7)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
initial_countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)
if initial_countdown_time is not NullValue:
Expand All @@ -645,7 +645,7 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1):

# STEP 8: TH reads from the DUT the PhaseList attribute
self.step(8)
if self.attributes_guard(has_attribute(attributes.PhaseList)):
if self.attributes_guard(attributes.PhaseList):
phase_list = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.PhaseList)
phase_list_len = 0
Expand All @@ -656,7 +656,7 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1):

# STEP 9: TH reads from the DUT the CurrentPhase attribute
self.step(9)
if self.attributes_guard(has_attribute(attributes.CurrentPhase)):
if self.attributes_guard(attributes.CurrentPhase):
current_phase = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CurrentPhase)
if (phase_list == NullValue) or (not phase_list):
Expand All @@ -669,12 +669,12 @@ async def TEST_TC_OPSTATE_BASE_2_2(self, endpoint=1):

# STEP 10: TH waits for {PIXIT.WAITTIME.COUNTDOWN}
self.step(10)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
time.sleep(wait_time)

# STEP 11: TH reads from the DUT the CountdownTime attribute
self.step(11)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)

Expand Down Expand Up @@ -815,7 +815,7 @@ async def TEST_TC_OPSTATE_BASE_2_3(self, endpoint=1):

# STEP 6: TH reads from the DUT the CountdownTime attribute
self.step(6)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
initial_countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)
if initial_countdown_time is not NullValue:
Expand All @@ -829,7 +829,7 @@ async def TEST_TC_OPSTATE_BASE_2_3(self, endpoint=1):

# STEP 8: TH reads from the DUT the CountdownTime attribute
self.step(8)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)

Expand Down Expand Up @@ -1061,7 +1061,7 @@ async def TEST_TC_OPSTATE_BASE_2_5(self, endpoint=1):

# STEP 5: TH reads from the DUT the CountdownTime attribute
self.step(5)
if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if self.attributes_guard(attributes.CountdownTime):
initial_countdown_time = await self.read_expect_success(endpoint=endpoint,
attribute=attributes.CountdownTime)

Expand Down
17 changes: 8 additions & 9 deletions src/python_testing/TC_RVCOPSTATE_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# factory-reset: true
# quiet: true
# quiet: false
# === END CI TEST ARGUMENTS ===

import logging

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
from chip.testing.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main, has_attribute
from chip.testing.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


class TC_RVCOPSTATE_2_1(MatterBaseTest):
def __init__(self, *args):
super().__init__(*args)
Expand Down Expand Up @@ -103,7 +102,7 @@ async def test_TC_RVCOPSTATE_2_1(self):
if self.is_ci:
self.write_to_app_pipe({"Name": "Reset"})

if self.attributes_guard(has_attribute(attributes.PhaseList)):
if self.attributes_guard(attributes.PhaseList):
self.print_step(2, "Read PhaseList attribute")
phase_list = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.PhaseList)

Expand All @@ -116,7 +115,7 @@ async def test_TC_RVCOPSTATE_2_1(self):

asserts.assert_less_equal(phase_list_len, 32, "PhaseList length(%d) must be less than 32!" % phase_list_len)

if self.attributes_guard(has_attribute(attributes.CurrentPhase)):
if self.attributes_guard(attributes.CurrentPhase):
self.print_step(3, "Read CurrentPhase attribute")
current_phase = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentPhase)
logging.info("CurrentPhase: %s" % (current_phase))
Expand All @@ -127,7 +126,7 @@ async def test_TC_RVCOPSTATE_2_1(self):
asserts.assert_true(0 <= current_phase < phase_list_len,
"CurrentPhase(%s) must be between 0 and %d" % (current_phase, (phase_list_len - 1)))

if self.attributes_guard(has_attribute(attributes.CountdownTime)):
if await self.attributes_guard(attributes.CountdownTime):
self.print_step(4, "Read CountdownTime attribute")
countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.CountdownTime)
Expand All @@ -137,7 +136,7 @@ async def test_TC_RVCOPSTATE_2_1(self):
asserts.assert_true(countdown_time >= 0 and countdown_time <= 259200,
"CountdownTime(%s) must be between 0 and 259200" % countdown_time)

if self.attributes_guard(has_attribute(attributes.OperationalStateList)):
if self.attributes_guard(attributes.OperationalStateList):
self.print_step(5, "Read OperationalStateList attribute")
operational_state_list = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.OperationalStateList)
Expand All @@ -160,7 +159,7 @@ async def test_TC_RVCOPSTATE_2_1(self):

asserts.assert_true(error_state_present, "The OperationalStateList does not have an ID entry of Error(0x03)")

if self.attributes_guard(has_attribute(attributes.OperationalState)):
if self.attributes_guard(attributes.OperationalState):
self.print_step(6, "Read OperationalState attribute")
operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.OperationalState)
Expand Down Expand Up @@ -227,7 +226,7 @@ async def test_TC_RVCOPSTATE_2_1(self):
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")
await self.read_and_validate_opstate(step="6n", expected_state=Clusters.RvcOperationalState.Enums.OperationalStateEnum.kDocked)

if self.attributes_guard(has_attribute(attributes.OperationalError)):
if self.attributes_guard(attributes.OperationalError):
self.print_step(7, "Read OperationalError attribute")
operational_error = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.OperationalError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,10 @@ def attributes_guard(self, attribute_condition: bool):
if self.attribute_guard(condition2_needs_to_be_false_to_skip_step):
# skip step 2 if condition not met
"""
if not attribute_condition:
attr_condition = await asyncio.wait_for(should_run_test_on_endpoint(self, has_attribute(attribute_condition)), timeout=60)
if not attr_condition:
self.mark_current_step_skipped()
return attribute_condition
return attr_condition

def mark_current_step_skipped(self):
try:
Expand Down
Loading