Skip to content

Commit

Permalink
[matter_yamltests] Do not include the pre/post processing to the test…
Browse files Browse the repository at this point in the history
… timeout (#26680)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jul 18, 2023
1 parent 6472827 commit 1583864
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/py_matter_yamltests/matter_yamltests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def run(self, parser_builder_config: TestParserBuilderConfig, runner_config: Tes
continue

loop = asyncio.get_event_loop()
result = loop.run_until_complete(asyncio.wait_for(
self._run(parser, runner_config), parser.timeout))
result = loop.run_until_complete(
self._run_with_timeout(parser, runner_config))
if isinstance(result, Exception):
raise (result)
elif not result:
Expand All @@ -157,11 +157,20 @@ def run(self, parser_builder_config: TestParserBuilderConfig, runner_config: Tes

return parser_builder.done

async def _run(self, parser: TestParser, config: TestRunnerConfig):
async def _run_with_timeout(self, parser: TestParser, config: TestRunnerConfig):
status = True
try:
await self.start()
status = await asyncio.wait_for(self._run(parser, config), parser.timeout)
except Exception as exception:
status = exception
finally:
await self.stop()
return status

async def _run(self, parser: TestParser, config: TestRunnerConfig):
status = True
try:
hooks = config.hooks
hooks.test_start(parser.filename, parser.name, parser.tests.count)

Expand Down Expand Up @@ -214,5 +223,4 @@ async def _run(self, parser: TestParser, config: TestRunnerConfig):
except Exception as exception:
status = exception
finally:
await self.stop()
return status

0 comments on commit 1583864

Please sign in to comment.