Skip to content

Commit 8ef6bb4

Browse files
authored
Python testing: Handle provisional aliased clusters (#37192)
Handle the case where there are cluster aliases, and only some of the aliased clusters are provisional. This is a weird case that only happens in the 1.3 spec, which was before we handled provisional in the automated testing. Test: See attached unit tests. Level control is now correctly marked in 1.3.
1 parent 5dee683 commit 8ef6bb4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/python_testing/TestSpecParsingSupport.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ def get_access_enum_from_string(access_str: str) -> Clusters.AccessControl.Enums
213213
' </revisionHistory>'
214214
' <clusterIds>'
215215
' <clusterId id="0xFFFE" name="Test Alias1"/>'
216-
' <clusterId id="0xFFFD" name="Test Alias2"/>'
216+
' <clusterId id="0xFFFD" name="Test Alias2">'
217+
' <provisionalConform/>'
218+
' </clusterId>'
217219
' </clusterIds>'
218220
' <classification hierarchy="base" role="application" picsCode="BASE" scope="Endpoint"/>'
219221
' <commands>'
@@ -396,6 +398,10 @@ def test_aliased_clusters(self):
396398
asserts.assert_true((0xFFFE, 'Test Alias1') in ids, "Unable to find Test Alias1 cluster in parsed clusters")
397399
asserts.assert_true((0xFFFD, 'Test Alias2') in ids, "Unable to find Test Alias2 cluster in parsed clusters")
398400

401+
# Test Alias2 is marked as provisional, and TestAlias1 is not
402+
asserts.assert_false(clusters[0xFFFE].is_provisional, "Test Alias1 is marked as provisional and should not be")
403+
asserts.assert_true(clusters[0xFFFD].is_provisional, "Test Alias2 is not marked as provisional and should be")
404+
399405
def test_known_aliased_clusters(self):
400406
known_aliased_clusters = set([(0x040C, 'Carbon Monoxide Concentration Measurement', 'CMOCONC'),
401407
(0x040D, 'Carbon Dioxide Concentration Measurement', 'CDOCONC'),

src/python_testing/matter_testing_infrastructure/chip/testing/spec_parsing.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,10 @@ def __init__(self, cluster: ElementTree.Element, cluster_id: Optional[uint], nam
228228
except (KeyError, StopIteration):
229229
self._derived = None
230230

231-
for id in cluster.iter('clusterIds'):
232-
if list(id.iter('provisionalConform')):
233-
self._is_provisional = True
231+
for ids in cluster.iter('clusterIds'):
232+
for id in ids.iter('clusterId'):
233+
if id.attrib['name'] == name and list(id.iter('provisionalConform')):
234+
self._is_provisional = True
234235

235236
self._pics: Optional[str] = None
236237
try:

0 commit comments

Comments
 (0)