Skip to content

Commit 5051453

Browse files
committed
Adjust yamltest_with_chip_repl_tester to use asyncio
1 parent 1b83649 commit 5051453

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

scripts/tests/chiptest/yamltest_with_chip_repl_tester.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async def execute_test(yaml, runner):
101101
'--pics-file',
102102
default=None,
103103
help='Optional PICS file')
104-
def main(setup_code, yaml_path, node_id, pics_file):
104+
async def main(setup_code, yaml_path, node_id, pics_file):
105105
# Setting up python environment for running YAML CI tests using python parser.
106106
with tempfile.NamedTemporaryFile() as chip_stack_storage:
107107
chip.native.Init()
@@ -122,7 +122,7 @@ def main(setup_code, yaml_path, node_id, pics_file):
122122
# Creating and commissioning to a single controller to match what is currently done when
123123
# running.
124124
dev_ctrl = ca_list[0].adminList[0].NewController()
125-
dev_ctrl.CommissionWithCode(setup_code, node_id)
125+
await dev_ctrl.CommissionWithCode(setup_code, node_id)
126126

127127
def _StackShutDown():
128128
# Tearing down chip stack. If not done in the correct order test will fail.
@@ -143,7 +143,7 @@ def _StackShutDown():
143143
runner = ReplTestRunner(
144144
clusters_definitions, certificate_authority_manager, dev_ctrl)
145145

146-
asyncio.run(execute_test(yaml, runner))
146+
await execute_test(yaml, runner)
147147

148148
except Exception:
149149
print(traceback.format_exc())
@@ -153,4 +153,6 @@ def _StackShutDown():
153153

154154

155155
if __name__ == '__main__':
156-
main()
156+
loop = asyncio.get_event_loop()
157+
loop.run_until_complete(main())
158+
loop.close()

0 commit comments

Comments
 (0)