Skip to content

Commit 209b0bc

Browse files
committed
Prevent cancellation of task with timeout in asyncio runner.
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)
1 parent 15032f1 commit 209b0bc

File tree

1 file changed

+2
-1
lines changed
  • scripts/py_matter_yamltests/matter_yamltests

1 file changed

+2
-1
lines changed

scripts/py_matter_yamltests/matter_yamltests/runner.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ async def _run_with_timeout(self, parser: TestParser, config: TestRunnerConfig):
162162
try:
163163
if config.auto_start_stop:
164164
await self.start()
165-
status = await asyncio.wait_for(self._run(parser, config), parser.timeout)
165+
task = self._run(parser, config)
166+
status = await asyncio.wait_for(asyncio.shield(task), parser.timeout)
166167
except (Exception, CancelledError) as exception:
167168
status = exception
168169
finally:

0 commit comments

Comments
 (0)