TC-ELDIST-2.2: Add Python automation test script for Electrical Distribution Cluster (Fixed-by-Manufacturer Quality)#72321
Conversation
…turer Quality Verification Adds TC_ELDIST_2_2.py implementing TC-ELDIST-2.2 from the Electrical Distribution Cluster test plan (chip-test-plans project-chip#6156): verifies all five mandatory ELDIST server attributes (MaxContinuousCurrent, MaxVoltage, NumberOfPoles, EndOfLife, ServiceEntranceRated) honor the Fixed-by- Manufacturer (X) quality across a single boot (re-read stability), reject writes (UNSUPPORTED_WRITE on three representative attributes), and persist unchanged across a DUT reboot. Uses the modern @run_if_endpoint_matches(has_cluster(...)) decorator for proper self-skip behavior when no endpoint hosts the ElectricalDistribution cluster. Adds a not_automated entry to test_metadata.yaml; this script will be enabled in CI once an example app provides an ELDIST server on a non-root endpoint (anticipated via the upcoming electrical-protection-app). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python test script, TC_ELDIST_2_2.py, to verify that the mandatory attributes of the Electrical Distribution Cluster maintain their values across reboots. It also adds this test to the not_automated list in test_metadata.yaml since the cluster is not yet integrated into any example app. The review feedback correctly points out that in the Matter Python SDK, attempting to write to read-only attributes raises an InteractionModelError rather than returning a status list. The feedback suggests importing InteractionModelError and wrapping the write operations in try-except blocks to properly assert the expected UnsupportedWrite status.
…ionModelError The Matter Python SDK raises InteractionModelError on writes to read-only attributes rather than returning a status list. Wrap the step 7 write attempt in try/except and assert e.status == UnsupportedWrite. Flagged by Gemini code review on PR project-chip#72321 (sibling TC-ELDIST-2.2 which inherited the same buggy pattern from the v5 matter_rag output). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ionModelError The Matter Python SDK raises InteractionModelError on writes to read-only attributes rather than returning a status list. Wrap each of the three write attempts (MaxVoltage, NumberOfPoles, ServiceEntranceRated) in try/except and assert e.status == UnsupportedWrite. Flagged by Gemini code review on initial submission. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…he three read-only write probes Replaces the try/except InteractionModelError pattern from the previous fix-up with the canonical write_single_attribute helper across all three write probes (MaxVoltage, NumberOfPoles, ServiceEntranceRated). Same semantic (asserts UnsupportedWrite on each read-only attribute) but matches the idiom used across the rest of src/python_testing/. Drops the now-unused InteractionModelError import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… steps Two changes, both prompted by today's review pass: 1. Per @andy31415 review on project-chip#72324 pointing to TC_ACL_2_2 as the canonical baseline, drops the separated steps_TC_ELDIST_2_2 / desc_TC_ELDIST_2_2 / pics_TC_ELDIST_2_2 methods in favor of: - @pics('ELDIST.S') decorator on the test method - Method-level docstring replacing desc_TC_* - Inline self.step(N, "description") calls 2. Wraps the operator reboot (step 7) and post-reboot persistence verification (step 8) in is_pics_sdk_ci_only dispatch, mirroring the pattern in project-chip#72324. The script is currently in not_automated, but the dual-mode wrapping makes it CI-safe when it eventually comes out of not_automated alongside an example app that hosts ELDIST. TestStep import dropped; pics added to the decorators import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
PR #72321: Size comparison from ca3e67c to 016d49e Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #72321 +/- ##
==========================================
+ Coverage 55.55% 56.09% +0.53%
==========================================
Files 1630 1640 +10
Lines 111148 112429 +1281
Branches 13410 13307 -103
==========================================
+ Hits 61753 63071 +1318
+ Misses 49395 49358 -37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The @pics() + @run_if_endpoint_matches() stack is an untested combination: the test gets silently skipped, then --fail-on-skipped converts that to a failure. Zero scripts in master combine these two. Aligns this script with TC_ACL_2_2 (the canonical @pics() baseline Andrei called out in PR review feedback) and with the fix validated on project-chip#72324. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per EMTT 2026-06-11 discussion, NV-persistence across reboot is
testable via the framework helper rather than the older
is_pics_sdk_ci_only + wait_for_user_input("Reboot...") dispatch.
Canonical reference pattern: TC_AVSUM_2_9.py.
Changes:
- Add app-ready-pattern: "APP STATUS: Starting event loop" to the
CI block (required for request_device_reboot()).
- Replace the step 7 dispatch with await self.request_device_reboot().
- Drop the step 8 is_pics_sdk_ci_only guard -- verification is now
unconditional (always runs in both CI and manual modes).
- Update docstring to reference the framework helper + TC_AVSUM_2_9.py
instead of the old dispatch.
CI on PR project-chip#72321 flagged the pre-reboot diagnostic log.info() call as G004 ("Logging statement uses f-string"). Switch to lazy %-style positional formatting, which is the upstream-preferred shape.
Summary
Adds
TC_ELDIST_2_2.pyimplementing TC-ELDIST-2.2 ("Fixed-by-Manufacturer Quality Verification with Server as DUT") from the Electrical Distribution Cluster test plan.This is the Python automation companion to TC-ELDIST-2.2 in chip-test-plans #6156. Filed as a sibling to the in-flight TC-ELDIST-2.1 PR #72278.
What the script tests
UNSUPPORTED_WRITE(complements PR TC-ELDIST-2.1: Add Python automation test script for Electrical Distribution Cluster #72278's write probe on MaxContinuousCurrent).nullstayingnull).Uses the modern
@run_if_endpoint_matches(has_cluster(Clusters.ElectricalDistribution))decorator for proper self-skip behavior when no endpoint hosts the cluster.Related issues / PRs
Testing
Filed as Draft because no example app currently integrates the Electrical Distribution cluster server on a non-root endpoint; the script will run cleanly under CI once an example app (anticipated
electrical-protection-app) provides ELDIST. Anot_automatedentry intest_metadata.yamlkeeps CI green in the interim.Readability checklist
not_automateduntil app integration)