def waitTestComplete(self, timeout):
    st = time.time()
while time.time() - st < timeout:
    if self.proc.poll() is not None:
        return self.proc.returncode == 0
else:
    time.sleep(2)
try:
    os.kill(-self.proc.pid, signal.SIGTERM)
except OSError as e:
    if e.errno != errno.ESRCH:
        pass
тайм-аут подпроцесса