Skip to content

Commit 1aa7dbd

Browse files
committed
Preserve the whole line in abspath_errors
1 parent 0cb8090 commit 1aa7dbd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/pytest_mypy/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ def runtest(self) -> None:
234234
"""Raise an exception if mypy found errors for this item."""
235235
results = MypyResults.from_session(self.session)
236236
abspath = str(self.path.resolve())
237-
errors = results.abspath_errors.get(abspath)
237+
errors = [
238+
error.partition(":")[2].strip()
239+
for error in results.abspath_errors.get(abspath, [])
240+
]
238241
if errors:
239242
if not all(
240243
error.partition(":")[2].partition(":")[0].strip() == "note"
@@ -327,7 +330,7 @@ def from_mypy(
327330
path, _, error = line.partition(":")
328331
abspath = str(Path(path).resolve())
329332
try:
330-
abspath_errors[abspath].append(error)
333+
abspath_errors[abspath].append(line)
331334
except KeyError:
332335
unmatched_lines.append(line)
333336

0 commit comments

Comments
 (0)