Skip to content

Commit

Permalink
Adjust yamltest_with_chip_repl_tester to use asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Jun 19, 2024
1 parent 6958c82 commit 61d0b1b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/tests/chiptest/yamltest_with_chip_repl_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def execute_test(yaml, runner):
'--pics-file',
default=None,
help='Optional PICS file')
def main(setup_code, yaml_path, node_id, pics_file):
async def main(setup_code, yaml_path, node_id, pics_file):
# Setting up python environment for running YAML CI tests using python parser.
with tempfile.NamedTemporaryFile() as chip_stack_storage:
chip.native.Init()
Expand All @@ -122,7 +122,7 @@ def main(setup_code, yaml_path, node_id, pics_file):
# Creating and commissioning to a single controller to match what is currently done when
# running.
dev_ctrl = ca_list[0].adminList[0].NewController()
dev_ctrl.CommissionWithCode(setup_code, node_id)
await dev_ctrl.CommissionWithCode(setup_code, node_id)

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

asyncio.run(execute_test(yaml, runner))
await execute_test(yaml, runner)

except Exception:
print(traceback.format_exc())
Expand All @@ -153,4 +153,6 @@ def _StackShutDown():


if __name__ == '__main__':
main()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

0 comments on commit 61d0b1b

Please sign in to comment.