Skip to content

Commit

Permalink
Update TC_TSTAT_2_2.py for v1.4.1 compatibility (#37528)
Browse files Browse the repository at this point in the history
* test: Update TC_TSTAT_2_2.py for v1.4.1 compatibility

Make two compatibility changes for v1.4.1 build:
1. Change import path from 'chip.testing.matter_testing' to
   'matter_testing_support' to fix import resolution
2. Reformat CI Test Arguments header block to use legacy parser format
   (single-line arguments instead of nested YAML structure)

Old path: chip.testing.matter_testing
New path: matter_testing_support

Parser compatibility:
- Flattened nested YAML structure in CI Test Arguments
- Changed 'factory-reset' to 'factoryreset' for parser support
- Maintained all original test parameters and values

Testing:
- Verified successful build on v1.4.1
- Validated CI Test Arguments parsing

* backport: Add get_endpoint() to MatterBaseTest for TC_TSTAT_2_2.py

Add get_endpoint() function to MatterBaseTest class to support the
backported TC_TSTAT_2_2.py thermostat test script. This function
was originally added to MatterBaseTest in a newer branch and is
required for the test script to function properly.
  • Loading branch information
swan-amazon authored Feb 12, 2025
1 parent 7d67dc9 commit d9999f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/python_testing/TC_TSTAT_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,19 @@
# for details about the block below.
#
# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs:
# run1:
# app: ${ALL_CLUSTERS_APP}
# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
# script-args: >
# --storage-path admin_storage.json
# --commissioning-method on-network
# --discriminator 1234
# --passcode 20202021
# --endpoint 1
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# factory-reset: true
# quiet: true
# test-runner-runs: run1
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# === END CI TEST ARGUMENTS ===

import logging

import chip.clusters as Clusters
from chip.interaction_model import Status
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

logger = logging.getLogger(__name__)
Expand Down
3 changes: 3 additions & 0 deletions src/python_testing/matter_testing_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,9 @@ def certificate_authority_manager(self) -> chip.CertificateAuthority.Certificate
def dut_node_id(self) -> int:
return self.matter_test_config.dut_node_ids[0]

def get_endpoint(self, default: Optional[int] = 0) -> int:
return self.matter_test_config.endpoint if self.matter_test_config.endpoint is not None else default

def setup_class(self):
super().setup_class()

Expand Down

0 comments on commit d9999f4

Please sign in to comment.