From ff4d1ab36742aa76770615be3791e3aae3416901 Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Thu, 16 Feb 2023 00:31:16 +0000 Subject: [PATCH] Attempt to fix unit test again --- runtimepy/task/basic/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtimepy/task/basic/__init__.py b/runtimepy/task/basic/__init__.py index cf5aefaa..27182ccd 100644 --- a/runtimepy/task/basic/__init__.py +++ b/runtimepy/task/basic/__init__.py @@ -8,6 +8,7 @@ from abc import ABC as _ABC from abc import abstractmethod as _abstractmethod import asyncio as _asyncio +from contextlib import suppress as _suppress from logging import getLogger as _getLogger from typing import Optional as _Optional @@ -72,7 +73,8 @@ async def task(self, period_s: float) -> _asyncio.Task[None]: if self._task is not None: if not self._task.done(): self._task.cancel() - await self._task + with _suppress(_asyncio.CancelledError): + await self._task _log_task_exception(self._task, logger=self.logger) self._task = None