Skip to content

Commit d58723f

Browse files
committed
Cancel subscriptions at the end of the test
1 parent 18081b4 commit d58723f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/python_testing/TC_DEM_2_10.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def steps_TC_DEM_2_10(self) -> list[TestStep]:
8686
"Verify DUT responds w/ status SUCCESS(0x00)"),
8787
TestStep("8", "TH counts all report transactions with an attribute report for the Forecast attribute over the next Forecast.Slots[0].MinDurationAdjustment}",
8888
"TH verifies that numberOfReportsReceived <= 2 + Forecast.Slots[0].MinDurationAdjustment}"),
89-
TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.DEM.TESTEVENTTRIGGER for Forecast Adjustment Test Event Clear",
89+
TestStep("9", "Cancel the subscription to the Forecast attribute",
90+
"The subscription is cancelled successfully"),
91+
TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.DEM.TESTEVENTTRIGGER for Forecast Adjustment Test Event Clear",
9092
"Verify DUT responds w/ status SUCCESS(0x00)"),
9193
]
9294

@@ -123,7 +125,7 @@ async def test_TC_DEM_2_10(self):
123125

124126
self.step("5")
125127
sub_handler = ClusterAttributeChangeAccumulator(Clusters.DeviceEnergyManagement)
126-
await sub_handler.start(self.default_controller, self.dut_node_id, self.matter_test_config.endpoint)
128+
await sub_handler.start(self.default_controller, self.dut_node_id, self.matter_test_config.endpoint, keepSubscriptions=False)
127129
sub_handler.reset()
128130

129131
self.step("6")
@@ -143,11 +145,14 @@ async def test_TC_DEM_2_10(self):
143145
time.sleep(forecast.slots[0].minDurationAdjustment)
144146

145147
count = sub_handler.attribute_report_counts[Clusters.DeviceEnergyManagement.Attributes.Forecast]
148+
logging.info(f"Number of Forecast updates {count}")
146149
asserts.assert_less_equal(count, 10, "More than 10 reports received")
147150

148151
self.step("9")
149-
await self.send_test_event_trigger_forecast_adjustment_clear()
152+
sub_handler.cancel()
150153

154+
self.step("10")
155+
await self.send_test_event_trigger_forecast_adjustment_clear()
151156

152157
if __name__ == "__main__":
153158
default_matter_test_main()

0 commit comments

Comments
 (0)