Skip to content

Commit

Permalink
Prevent cancellation of task with timeout in asyncio runner.
Browse files Browse the repository at this point in the history
I am yet unclear why on new python/os/websocket we do not get
a timeout error, however from what I could tell, wait_for would
cancel the websocket.recv and that stops instead of throwing
a timeout exception, resulting in a full success result.

Making this change seems to make the test TestPurposefulFailureExtraReportingOnToggle
pass on my machine (well ... fail as expected instead of passing with a
successful stop)
  • Loading branch information
andreilitvin committed Aug 16, 2024
1 parent 15032f1 commit 209b0bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/py_matter_yamltests/matter_yamltests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ async def _run_with_timeout(self, parser: TestParser, config: TestRunnerConfig):
try:
if config.auto_start_stop:
await self.start()
status = await asyncio.wait_for(self._run(parser, config), parser.timeout)
task = self._run(parser, config)
status = await asyncio.wait_for(asyncio.shield(task), parser.timeout)
except (Exception, CancelledError) as exception:
status = exception
finally:
Expand Down

0 comments on commit 209b0bc

Please sign in to comment.