Skip to content

Commit 6d2ec9c

Browse files
authored
Sort error lines in unknown format to the top (#12)
* sort error lines in unknown format to the top * bump version to 1.2.0
1 parent a2c3fc0 commit 6d2ec9c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pytest_mypy/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,13 @@ def remove_empty_lines(lines: List[str]) -> List[str]:
167167
def sorted_by_file_and_line(lines: List[str]) -> List[str]:
168168
def extract_parts_as_tuple(line: str) -> Tuple[str, int, str]:
169169
if len(line.split(':', maxsplit=2)) < 3:
170-
return ('', 0, '')
170+
return '', 0, ''
171171

172172
fname, line_number, contents = line.split(':', maxsplit=2)
173-
return fname, int(line_number), contents
173+
try:
174+
return fname, int(line_number), contents
175+
except ValueError:
176+
return '', 0, ''
174177
return sorted(lines, key=extract_parts_as_tuple)
175178

176179

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name='pytest-mypy-plugins',
15-
version='1.1.0',
15+
version='1.2.0',
1616
description='pytest plugin for writing tests for mypy plugins',
1717
long_description=readme,
1818
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)