From 76b02ed5f9b37e4a7ea316c3e02f0f6fe25b5ec0 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 18 Dec 2018 21:12:29 +0000 Subject: [PATCH] Don't raise if a process vanishes before evaluation --- tests/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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):