diff --git a/tests/__init__.py b/tests/__init__.py index 8a054ed..a1cc234 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -6,6 +6,7 @@ import time from pathlib import Path from unittest import TestCase +import psutil from aiohttp.test_utils import AioHTTPTestCase, unused_port from aiounittest import AsyncTestCase from click.testing import CliRunner @@ -35,8 +36,11 @@ class BaseTestCase(TestCase): def terminate_dummy_processes(self): dummy_processes = [] for process in get_root_process().children(recursive=True): - if str(self.DUMMY_EXE) in " ".join(process.cmdline()): - dummy_processes.append(process) + try: + if str(self.DUMMY_EXE) in " ".join(process.cmdline()): + dummy_processes.append(process) + except psutil.NoSuchProcess: + continue terminate_processes(dummy_processes) def tearDown(self):