From 61d0b1b1e4e84e9bab85d835c92c441372be2f1a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 18 Jun 2024 22:50:15 +0200 Subject: [PATCH] Adjust yamltest_with_chip_repl_tester to use asyncio --- .../tests/chiptest/yamltest_with_chip_repl_tester.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py b/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py index 484e21370e5252..ccd026438d6f39 100644 --- a/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py +++ b/scripts/tests/chiptest/yamltest_with_chip_repl_tester.py @@ -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() @@ -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. @@ -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()) @@ -153,4 +153,6 @@ def _StackShutDown(): if __name__ == '__main__': - main() + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) + loop.close()