@@ -1142,8 +1142,6 @@ def setup_class(self):
1142
1142
self .current_step_index = 0
1143
1143
self .step_start_time = datetime .now (timezone .utc )
1144
1144
self .step_skipped = False
1145
- self .global_wildcard = asyncio .wait_for (self .default_controller .Read (self .dut_node_id , [(Clusters .Descriptor ), Attribute .AttributePath (None , None , GlobalAttributeIds .ATTRIBUTE_LIST_ID ), Attribute .AttributePath (
1146
- None , None , GlobalAttributeIds .FEATURE_MAP_ID ), Attribute .AttributePath (None , None , GlobalAttributeIds .ACCEPTED_COMMAND_LIST_ID )]), timeout = 60 )
1147
1145
# self.stored_global_wildcard stores value of self.global_wildcard after first async call.
1148
1146
# Because setup_class can be called before commissioning, this variable is lazy-initialized
1149
1147
# where the read is deferred until the first guard function call that requires global attributes.
@@ -1479,6 +1477,13 @@ def pics_guard(self, pics_condition: bool):
1479
1477
self .mark_current_step_skipped ()
1480
1478
return pics_condition
1481
1479
1480
+ async def _populate_wildcard (self ):
1481
+ """ Populates self.stored_global_wildcard if not already filled. """
1482
+ if self .stored_global_wildcard is None :
1483
+ global_wildcard = asyncio .wait_for (self .default_controller .Read (self .dut_node_id , [(Clusters .Descriptor ), Attribute .AttributePath (None , None , GlobalAttributeIds .ATTRIBUTE_LIST_ID ), Attribute .AttributePath (
1484
+ None , None , GlobalAttributeIds .FEATURE_MAP_ID ), Attribute .AttributePath (None , None , GlobalAttributeIds .ACCEPTED_COMMAND_LIST_ID )]), timeout = 60 )
1485
+ self .stored_global_wildcard = await global_wildcard
1486
+
1482
1487
async def attribute_guard (self , endpoint : int , attribute : ClusterObjects .ClusterAttributeDescriptor ):
1483
1488
"""Similar to pics_guard above, except checks a condition and if False marks the test step as skipped and
1484
1489
returns False using attributes against attributes_list, otherwise returns True.
@@ -1492,8 +1497,7 @@ async def attribute_guard(self, endpoint: int, attribute: ClusterObjects.Cluster
1492
1497
if self.attribute_guard(condition2_needs_to_be_false_to_skip_step):
1493
1498
# skip step 2 if condition not met
1494
1499
"""
1495
- if self .stored_global_wildcard is None :
1496
- self .stored_global_wildcard = await self .global_wildcard
1500
+ await self ._populate_wildcard ()
1497
1501
attr_condition = _has_attribute (wildcard = self .stored_global_wildcard , endpoint = endpoint , attribute = attribute )
1498
1502
if not attr_condition :
1499
1503
self .mark_current_step_skipped ()
@@ -1512,8 +1516,7 @@ async def command_guard(self, endpoint: int, command: ClusterObjects.ClusterComm
1512
1516
if self.command_guard(condition2_needs_to_be_false_to_skip_step):
1513
1517
# skip step 2 if condition not met
1514
1518
"""
1515
- if self .stored_global_wildcard is None :
1516
- self .stored_global_wildcard = await self .global_wildcard
1519
+ await self ._populate_wildcard ()
1517
1520
cmd_condition = _has_command (wildcard = self .stored_global_wildcard , endpoint = endpoint , command = command )
1518
1521
if not cmd_condition :
1519
1522
self .mark_current_step_skipped ()
@@ -1532,8 +1535,7 @@ async def feature_guard(self, endpoint: int, cluster: ClusterObjects.ClusterObje
1532
1535
if self.feature_guard(condition2_needs_to_be_false_to_skip_step):
1533
1536
# skip step 2 if condition not met
1534
1537
"""
1535
- if self .stored_global_wildcard is None :
1536
- self .stored_global_wildcard = await self .global_wildcard
1538
+ await self ._populate_wildcard ()
1537
1539
feat_condition = _has_feature (wildcard = self .stored_global_wildcard , endpoint = endpoint , cluster = cluster , feature = feature_int )
1538
1540
if not feat_condition :
1539
1541
self .mark_current_step_skipped ()
0 commit comments