32
32
from chip .clusters import Attribute
33
33
34
34
try :
35
- from matter_testing_support import (MatterBaseTest , MatterTestConfig , async_test_body , has_attribute ,
36
- has_cluster , has_feature , run_if_endpoint_matches , run_on_singleton_matching_endpoint ,
37
- should_run_test_on_endpoint )
35
+ from matter_testing_support import (MatterBaseTest , MatterTestConfig , async_test_body , has_attribute , has_cluster , has_feature ,
36
+ run_if_endpoint_matches , run_on_singleton_matching_endpoint , should_run_test_on_endpoint )
38
37
except ImportError :
39
38
sys .path .append (os .path .abspath (os .path .join (os .path .dirname (__file__ ), '..' )))
40
39
from matter_testing_support import (MatterBaseTest , MatterTestConfig , async_test_body , has_attribute ,
@@ -107,9 +106,6 @@ def show_prompt(self,
107
106
108
107
109
108
class TestDecorators (MatterBaseTest ):
110
- def teardown_test (self ):
111
- self .matter_test_config .endpoint = None
112
-
113
109
def test_checkers (self ):
114
110
has_onoff = has_cluster (Clusters .OnOff )
115
111
has_onoff_onoff = has_attribute (Clusters .OnOff .Attributes .OnOff )
@@ -278,7 +274,7 @@ def run_check(test_name: str, read_response: Attribute.AsyncReadTransaction.Read
278
274
stopped_ok = hooks .stopped == num_endpoints
279
275
if not ok or not started_ok or not skipped_ok or not stopped_ok :
280
276
failures .append (
281
- f'Expected { expected_runs } run of { test_name } , skips expected: { expect_skip } . Runs: { hooks .started } , skips: { hooks .skipped } stops: { hooks .stopped } ' )
277
+ f'Expected { num_endpoints } run of { test_name } , skips expected: { expect_skip } . Runs: { hooks .started } , skips: { hooks .skipped } stops: { hooks .stopped } ' )
282
278
283
279
def check_once_per_endpoint (test_name : str ):
284
280
run_check (test_name , get_clusters ([0 , 1 ]), False )
@@ -341,22 +337,22 @@ def run_singleton_dynamic(test_name: str, cluster_list: list[int]) -> tuple[bool
341
337
return ok , hooks
342
338
343
339
def expect_success_dynamic (test_name : str , cluster_list : list [int ]):
344
- ok , hooks = run_singleton_dynamic (test_name , [ 0 ] )
340
+ ok , hooks = run_singleton_dynamic (test_name , cluster_list )
345
341
if not ok :
346
342
failures .append (f"Unexpected failure on { test_name } with cluster list { cluster_list } " )
347
343
if hooks .skipped :
348
344
failures .append (f'Unexpected skip call on { test_name } with cluster list { cluster_list } ' )
349
345
350
346
def expect_failure_dynamic (test_name : str , cluster_list : list [int ]):
351
- ok = run_singleton_dynamic (test_name , [ 0 ] )
347
+ ok , hooks = run_singleton_dynamic (test_name , cluster_list )
352
348
if ok :
353
349
failures .append (f"Unexpected success on { test_name } with cluster list { cluster_list } " )
354
350
if hooks .skipped :
355
351
# We don't expect a skip call because the test actually failed.
356
352
failures .append (f'Skip called for { test_name } with cluster list { cluster_list } ' )
357
353
358
354
def expect_skip_dynamic (test_name : str , cluster_list : list [int ]):
359
- ok = run_singleton_dynamic (test_name , [ 0 ] )
355
+ ok , hooks = run_singleton_dynamic (test_name , cluster_list )
360
356
if not ok :
361
357
failures .append (f"Unexpected failure on { test_name } with cluster list { cluster_list } " )
362
358
if not hooks .skipped :
@@ -375,10 +371,10 @@ def expect_skip_dynamic(test_name: str, cluster_list: list[int]):
375
371
expect_failure_dynamic (test_name , [0 , 1 ])
376
372
377
373
test_name = 'test_no_run_on_singleton_matching_endpoint'
378
- # no failure, expect skips on single endpoints , expect asserts on multiple matching
374
+ # no failure, no matches , expect skips on all endpoints
379
375
expect_skip_dynamic (test_name , [0 ])
380
376
expect_skip_dynamic (test_name , [1 ])
381
- expect_failure_dynamic (test_name , [0 , 1 ])
377
+ expect_skip_dynamic (test_name , [0 , 1 ])
382
378
383
379
test_runner .Shutdown ()
384
380
print (
0 commit comments