def run(self):
for s in self.test_suites:
script = os.path.join(s, 'run.py')
start_time = time.time()
manifest = self.load_manifest(s)
os.chdir(s)
info("Running tests from {0}".format(s))
args = [e('${venvdir}/bin/python'), script]
test = None
try:
test = subprocess.Popen(
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True
)
test.wait(timeout=manifest['timeout'])
except subprocess.TimeoutExpired as err:
self.generate_suite_error(
os.path.join(s, 'results.xml'),
manifest['name'],
time.time() - start_time,
'Test timeout reached',
err
)
except subprocess.SubprocessError as err:
self.generate_suite_error(
os.path.join(s, 'results.xml'),
manifest['name'],
time.time() - start_time,
'Test could not be started',
err
)
out, err = test.communicate()
if test and test.returncode:
self.generate_suite_error(
os.path.join(s, 'results.xml'),
manifest['name'],
time.time() - start_time,
'Test process has returned an error',
out
)
info("{0} error:".format(script))
print(out.decode('utf-8'))
评论列表
文章目录