def parse_test_error(lines):
    result = []
    lines_ = iter(lines)
    location = {'file_path': '', 'line_no': 1}
    for line in lines_:
        result.append(line)
        failure = match_error(line)
        if failure and location['file_path']:
            result.append(
                make_error_format(
                    location['file_path'],
                    location['line_no'],
                    failure,
                ),
            )
            break
        else:
            file_location = match_file_location(line)
            if file_location:
                location = file_location
    result.extend(lines_)
    return result
Parse test error coming from an error report.
dataset/ETHPy150Open okcompute/vim-python-tests-runner/compiler/runners/pytest.py/parse_test_error