Skip to content

Commit b046a7b

Browse files
committed
Make TestSubscriptionResumptionCapacityStep2 an async test
Eliminate use of ZCLSubscribeAttribute and embrace asyncio.
1 parent c7cc3d8 commit b046a7b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/controller/python/test/test_scripts/base.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1453,8 +1453,8 @@ async def TestSubscriptionResumptionCapacityStep1(self, nodeid: int, endpoint: i
14531453

14541454
return True
14551455

1456-
def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, remote_ip: str, ssh_port: int,
1457-
remote_server_app: str, subscription_capacity: int):
1456+
async def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, remote_ip: str, ssh_port: int,
1457+
remote_server_app: str, subscription_capacity: int):
14581458
try:
14591459
self.logger.info("Restart remote deivce")
14601460
extra_agrs = f"--thread --discriminator 3840 --subscription-capacity {subscription_capacity}"
@@ -1468,8 +1468,9 @@ def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, re
14681468
self.logger.info("Send a new subscription request from the second controller")
14691469
# Close previous session so that the second controller will res-establish the session with the remote device
14701470
self.devCtrl.CloseSession(nodeid)
1471-
self.devCtrl.ZCLSubscribeAttribute(
1472-
"BasicInformation", "NodeLabel", nodeid, endpoint, 1, 50, keepSubscriptions=True, autoResubscribe=False)
1471+
await self.devCtrl.ReadAttribute(nodeid, [(endpoint, Clusters.BasicInformation.Attributes.NodeLabel)], None,
1472+
False, reportInterval=(1, 50),
1473+
keepSubscriptions=True, autoResubscribe=False)
14731474

14741475
if restartRemoteThread.is_alive():
14751476
# Thread join timed out

src/controller/python/test/test_scripts/subscription_resumption_capacity_test_ctrl2.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# Commissioning test.
2121

22+
import asyncio
2223
import os
2324
import sys
2425
from optparse import OptionParser
@@ -125,8 +126,9 @@ def main():
125126
"Failed on on-network commissioing")
126127

127128
FailIfNot(
128-
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
129-
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity),
129+
asyncio.run(
130+
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
131+
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity)),
130132
"Failed on testing subscription resumption capacity")
131133

132134
timeoutTicker.stop()

0 commit comments

Comments
 (0)