File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
"""Mypy static type checker plugin for Pytest"""
2
2
3
3
import json
4
- import os
5
4
from pathlib import Path
6
5
from tempfile import NamedTemporaryFile
7
6
from typing import Dict , List , Optional , TextIO
@@ -232,16 +231,17 @@ def from_mypy(
232
231
str (path .absolute ()): [] for path in paths
233
232
} # type: MypyResults._abspath_errors_type
234
233
234
+ cwd = Path .cwd ()
235
235
stdout , stderr , status = mypy .api .run (
236
- opts + [os . path . relpath ( key ) for key in abspath_errors .keys ()]
236
+ opts + [str ( Path ( key ). relative_to ( cwd ) ) for key in abspath_errors .keys ()]
237
237
)
238
238
239
239
unmatched_lines = []
240
240
for line in stdout .split ("\n " ):
241
241
if not line :
242
242
continue
243
243
path , _ , error = line .partition (":" )
244
- abspath = os . path . abspath ( path )
244
+ abspath = str ( Path ( path ). absolute () )
245
245
try :
246
246
abspath_errors [abspath ].append (error )
247
247
except KeyError :
@@ -310,4 +310,4 @@ def pytest_terminal_summary(terminalreporter, config):
310
310
terminalreporter .write_line (results .unmatched_stdout , ** color )
311
311
if results .stderr :
312
312
terminalreporter .write_line (results .stderr , yellow = True )
313
- os . remove (config ._mypy_results_path )
313
+ Path (config ._mypy_results_path ). unlink ( )
You can’t perform that action at this time.
0 commit comments