Don't raise if a process vanishes before evaluation
This commit is contained in:
parent
fbdef2ecbf
commit
76b02ed5f9
1 changed files with 6 additions and 2 deletions
|
@ -6,6 +6,7 @@ import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import psutil
|
||||||
from aiohttp.test_utils import AioHTTPTestCase, unused_port
|
from aiohttp.test_utils import AioHTTPTestCase, unused_port
|
||||||
from aiounittest import AsyncTestCase
|
from aiounittest import AsyncTestCase
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
@ -35,8 +36,11 @@ class BaseTestCase(TestCase):
|
||||||
def terminate_dummy_processes(self):
|
def terminate_dummy_processes(self):
|
||||||
dummy_processes = []
|
dummy_processes = []
|
||||||
for process in get_root_process().children(recursive=True):
|
for process in get_root_process().children(recursive=True):
|
||||||
if str(self.DUMMY_EXE) in " ".join(process.cmdline()):
|
try:
|
||||||
dummy_processes.append(process)
|
if str(self.DUMMY_EXE) in " ".join(process.cmdline()):
|
||||||
|
dummy_processes.append(process)
|
||||||
|
except psutil.NoSuchProcess:
|
||||||
|
continue
|
||||||
terminate_processes(dummy_processes)
|
terminate_processes(dummy_processes)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|
Reference in a new issue