@@ -1745,15 +1745,15 @@ def async_runner(self: MatterBaseTest, *args, **kwargs):
1745
1745
return async_runner
1746
1746
1747
1747
1748
- def per_node_test (body ):
1748
+ def run_once_for_node (body ):
1749
1749
""" Decorator to be used for PICS-free tests that apply to the entire node.
1750
1750
1751
1751
Use this decorator when your script needs to be run once to validate the whole node.
1752
1752
To use this decorator, the test must NOT have an associated pics_ method.
1753
1753
"""
1754
1754
1755
1755
def whole_node_runner (self : MatterBaseTest , * args , ** kwargs ):
1756
- asserts .assert_false (self .get_test_pics (self .current_test_info .name ), "pics_ method supplied for per_node_test ." )
1756
+ asserts .assert_false (self .get_test_pics (self .current_test_info .name ), "pics_ method supplied for run_once_for_node ." )
1757
1757
return _async_runner (body , self , * args , ** kwargs )
1758
1758
1759
1759
return whole_node_runner
@@ -1770,9 +1770,9 @@ def _has_cluster(wildcard, endpoint, cluster: ClusterObjects.Cluster) -> bool:
1770
1770
1771
1771
1772
1772
def has_cluster (cluster : ClusterObjects .ClusterObjectDescriptor ) -> EndpointCheckFunction :
1773
- """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator.
1773
+ """ EndpointCheckFunction that can be passed as a parameter to the run_for_each_matching_endpoint decorator.
1774
1774
1775
- Use this function with the per_endpoint_test decorator to run this test on all endpoints with
1775
+ Use this function with the run_for_each_matching_endpoint decorator to run this test on all endpoints with
1776
1776
the specified cluster. For example, given a device with the following conformance
1777
1777
1778
1778
EP0: cluster A, B, C
@@ -1781,7 +1781,7 @@ def has_cluster(cluster: ClusterObjects.ClusterObjectDescriptor) -> EndpointChec
1781
1781
EP3, cluster E
1782
1782
1783
1783
And the following test specification:
1784
- @per_endpoint_test (has_cluster(Clusters.D))
1784
+ @run_for_each_matching_endpoint (has_cluster(Clusters.D))
1785
1785
test_mytest(self):
1786
1786
...
1787
1787
@@ -1803,9 +1803,9 @@ def _has_attribute(wildcard, endpoint, attribute: ClusterObjects.ClusterAttribut
1803
1803
1804
1804
1805
1805
def has_attribute (attribute : ClusterObjects .ClusterAttributeDescriptor ) -> EndpointCheckFunction :
1806
- """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator.
1806
+ """ EndpointCheckFunction that can be passed as a parameter to the run_for_each_matching_endpoint decorator.
1807
1807
1808
- Use this function with the per_endpoint_test decorator to run this test on all endpoints with
1808
+ Use this function with the run_for_each_matching_endpoint decorator to run this test on all endpoints with
1809
1809
the specified attribute. For example, given a device with the following conformance
1810
1810
1811
1811
EP0: cluster A, B, C
@@ -1814,7 +1814,7 @@ def has_attribute(attribute: ClusterObjects.ClusterAttributeDescriptor) -> Endpo
1814
1814
EP3, cluster D without attribute d
1815
1815
1816
1816
And the following test specification:
1817
- @per_endpoint_test (has_attribute(Clusters.D.Attributes.d))
1817
+ @run_for_each_matching_endpoint (has_attribute(Clusters.D.Attributes.d))
1818
1818
test_mytest(self):
1819
1819
...
1820
1820
@@ -1835,9 +1835,9 @@ def _has_feature(wildcard, endpoint, cluster: ClusterObjects.ClusterObjectDescri
1835
1835
1836
1836
1837
1837
def has_feature (cluster : ClusterObjects .ClusterObjectDescriptor , feature : IntFlag ) -> EndpointCheckFunction :
1838
- """ EndpointCheckFunction that can be passed as a parameter to the per_endpoint_test decorator.
1838
+ """ EndpointCheckFunction that can be passed as a parameter to the run_for_each_matching_endpoint decorator.
1839
1839
1840
- Use this function with the per_endpoint_test decorator to run this test on all endpoints with
1840
+ Use this function with the run_for_each_matching_endpoint decorator to run this test on all endpoints with
1841
1841
the specified feature. For example, given a device with the following conformance
1842
1842
1843
1843
EP0: cluster A, B, C
@@ -1846,7 +1846,7 @@ def has_feature(cluster: ClusterObjects.ClusterObjectDescriptor, feature: IntFla
1846
1846
EP3, cluster D without feature F0
1847
1847
1848
1848
And the following test specification:
1849
- @per_endpoint_test (has_feature(Clusters.D.Bitmaps.Feature.F0))
1849
+ @run_for_each_matching_endpoint (has_feature(Clusters.D.Bitmaps.Feature.F0))
1850
1850
test_mytest(self):
1851
1851
...
1852
1852
@@ -1859,15 +1859,15 @@ def has_feature(cluster: ClusterObjects.ClusterObjectDescriptor, feature: IntFla
1859
1859
1860
1860
1861
1861
async def get_accepted_endpoints_for_test (self : MatterBaseTest , accept_function : EndpointCheckFunction ) -> list [uint ]:
1862
- """ Helper function for the per_endpoint_test decorator.
1862
+ """ Helper function for the run_for_each_matching_endpoint decorator.
1863
1863
1864
1864
Returns a list of endpoints on which the test should be run given the accept_function for the test.
1865
1865
"""
1866
1866
wildcard = await self .default_controller .Read (self .dut_node_id , [()])
1867
1867
return [e for e in wildcard .attributes .keys () if accept_function (wildcard , e )]
1868
1868
1869
1869
1870
- def per_endpoint_test (accept_function : EndpointCheckFunction ):
1870
+ def run_for_each_matching_endpoint (accept_function : EndpointCheckFunction ):
1871
1871
""" Test decorator for a test that needs to be run once per endpoint that meets the accept_function criteria.
1872
1872
1873
1873
Place this decorator above the test_ method to have the test framework run this test once per endpoint.
@@ -1882,7 +1882,7 @@ def per_endpoint_test(accept_function: EndpointCheckFunction):
1882
1882
EP3, cluster E
1883
1883
1884
1884
And the following test specification:
1885
- @per_endpoint_test (has_cluster(Clusters.D))
1885
+ @run_for_each_matching_endpoint (has_cluster(Clusters.D))
1886
1886
test_mytest(self):
1887
1887
...
1888
1888
@@ -1898,9 +1898,10 @@ def per_endpoint_test(accept_function: EndpointCheckFunction):
1898
1898
Tests that use this decorator cannot use a pics_ method for test selection and should not reference any
1899
1899
PICS values internally.
1900
1900
"""
1901
- def per_endpoint_test_internal (body ):
1901
+ def run_for_each_matching_endpoint_internal (body ):
1902
1902
def per_endpoint_runner (self : MatterBaseTest , * args , ** kwargs ):
1903
- asserts .assert_false (self .get_test_pics (self .current_test_info .name ), "pics_ method supplied for per_endpoint_test." )
1903
+ asserts .assert_false (self .get_test_pics (self .current_test_info .name ),
1904
+ "pics_ method supplied for run_for_each_matching_endpoint." )
1904
1905
runner_with_timeout = asyncio .wait_for (get_accepted_endpoints_for_test (self , accept_function ), timeout = 30 )
1905
1906
endpoints = asyncio .run (runner_with_timeout )
1906
1907
if not endpoints :
@@ -1927,7 +1928,7 @@ def per_endpoint_runner(self: MatterBaseTest, *args, **kwargs):
1927
1928
self .runner_hook .test_stop (exception = None , duration = test_duration )
1928
1929
self .matter_test_config .endpoint = original_ep
1929
1930
return per_endpoint_runner
1930
- return per_endpoint_test_internal
1931
+ return run_for_each_matching_endpoint_internal
1931
1932
1932
1933
1933
1934
class CommissionDeviceTest (MatterBaseTest ):
0 commit comments