Skip to content

Commit 6daa0e1

Browse files
authored
Merge pull request #170 from dmtucker/generalize
Generalize MypyResults.from_mypy
2 parents 379afde + ed5ed3e commit 6daa0e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pytest_mypy.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def load(cls, results_f: TextIO) -> "MypyResults":
252252
@classmethod
253253
def from_mypy(
254254
cls,
255-
items: List[MypyFileItem],
255+
paths: List[Path],
256256
*,
257257
opts: Optional[List[str]] = None,
258258
) -> "MypyResults":
@@ -263,7 +263,7 @@ def from_mypy(
263263
if opts is None: # pragma: no cover
264264
opts = mypy_argv[:]
265265
abspath_errors = {
266-
os.path.abspath(str(item.fspath)): [] for item in items
266+
str(path.absolute()): [] for path in paths
267267
} # type: MypyResults._abspath_errors_type
268268

269269
stdout, stderr, status = mypy.api.run(
@@ -304,7 +304,11 @@ def from_session(cls, session) -> "MypyResults":
304304
results = cls.load(results_f)
305305
except FileNotFoundError:
306306
results = cls.from_mypy(
307-
[item for item in session.items if isinstance(item, MypyFileItem)],
307+
[
308+
Path(item.fspath)
309+
for item in session.items
310+
if isinstance(item, MypyFileItem)
311+
],
308312
)
309313
with open(results_path, mode="w") as results_f:
310314
results.dump(results_f)

0 commit comments

Comments
 (0)