(loop)
| 191 | |
| 192 | |
| 193 | def _cancel_all_tasks(loop): |
| 194 | to_cancel = tasks.all_tasks(loop) |
| 195 | if not to_cancel: |
| 196 | return |
| 197 | |
| 198 | for task in to_cancel: |
| 199 | task.cancel() |
| 200 | |
| 201 | loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True)) |
| 202 | |
| 203 | for task in to_cancel: |
| 204 | if task.cancelled(): |
| 205 | continue |
| 206 | if task.exception() is not None: |
| 207 | loop.call_exception_handler({ |
| 208 | 'message': 'unhandled exception during asyncio.run() shutdown', |
| 209 | 'exception': task.exception(), |
| 210 | 'task': task, |
| 211 | }) |
no test coverage detected