def finish(self, proc):
super(PytestExecCommand, self).finish(proc)
view = self.output_view
output = get_whole_text(view).strip()
last_line = output[output.rfind('\n'):]
summary = ''
matches = re.finditer(r' ([\d]+) ', last_line)
if matches:
test_count = sum(int(m.group(1)) for m in matches)
summary = "Ran %s tests. " % (test_count)
summary += last_line.replace('=', '')
failures = proc.exit_code() != 0
if failures:
broadcast("pytest_will_fail")
broadcast('pytest_finished', {
"summary": summary,
"failures": failures
})
# This is a 'best' guess. Maybe we should parse the output for the
# `rootdir` pytest uses.
base_dir = view.settings().get('result_base_dir')
# For the 'line' go with output regex parsing bc the reporter
# isn't useful at all.
if self._tb_mode == 'line':
sublime.set_timeout_async(
functools.partial(
parse_output, output, base_dir, Matchers[self._tb_mode]))
else:
sublime.set_timeout_async(
functools.partial(
parse_result, base_dir, Matchers[self._tb_mode]))
评论列表
文章目录