diff options
| author | Josh Wilson <person142@users.noreply.github.com> | 2020-06-07 13:11:58 -0700 |
|---|---|---|
| committer | Josh Wilson <person142@users.noreply.github.com> | 2020-06-07 14:17:38 -0700 |
| commit | 8362a36c7e78164429813033212e256d612ec0a3 (patch) | |
| tree | b262622e92d38aee209321fac1c40274c96361d1 | |
| parent | 744512dc5d8c55b4873c3dd71a82b7915a886965 (diff) | |
| download | numpy-8362a36c7e78164429813033212e256d612ec0a3.tar.gz | |
MAINT: modify mypy error line parsing to work on windows
It currently splits on ":", which causes problems with drives.
| -rw-r--r-- | numpy/tests/test_typing.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/tests/test_typing.py b/numpy/tests/test_typing.py index 3fb1ce243..04ea3c64d 100644 --- a/numpy/tests/test_typing.py +++ b/numpy/tests/test_typing.py @@ -78,7 +78,13 @@ def test_fail(path): if not error_line: continue - lineno = int(error_line.split(":")[1]) + match = re.match( + r"^.+\.py:(?P<lineno>\d+): (error|note): .+$", + error_line, + ) + if match is None: + raise ValueError(f"Unexpected error line format: {error_line}") + lineno = int(match.group('lineno')) errors[lineno] += error_line for i, line in enumerate(lines): @@ -114,7 +120,13 @@ def test_reveal(path): if not error_line: continue - lineno = int(error_line.split(":")[1]) + match = re.match( + r"^.+\.py:(?P<lineno>\d+): note: .+$", + error_line, + ) + if match is None: + raise ValueError(f"Unexpected reveal line format: {error_line}") + lineno = int(match.group('lineno')) assert "Revealed type is" in error_line marker = lines[lineno - 1].split("# E:")[-1].strip() assert marker in error_line |
