Don't raise if a process vanishes before evaluation

This commit is contained in:
Jake Howard 2018-12-18 21:12:29 +00:00
parent fbdef2ecbf
commit 76b02ed5f9
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -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):