Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

MAINT: upgrade mypy to 0.770 (the latest) #45

Merged
merged 1 commit into from
Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ black==18.9b0
flake8==3.6.0
flake8-pyi==18.3.1
pytest==4.0.0
mypy==0.641
mypy==0.770
15 changes: 12 additions & 3 deletions tests/test_stubs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
from collections import defaultdict

import pytest
Expand Down Expand Up @@ -38,8 +39,11 @@ def get_test_cases(directory):
@pytest.mark.parametrize("path,py2_arg", get_test_cases(PASS_DIR))
def test_success(path, py2_arg):
stdout, stderr, exitcode = api.run([path] + py2_arg)
assert stdout == ''
assert exitcode == 0
assert exitcode == 0, stdout
assert re.match(
r'Success: no issues found in \d+ source files?',
stdout.strip(),
)


@pytest.mark.parametrize("path,py2_arg", get_test_cases(FAIL_DIR))
Expand All @@ -52,7 +56,12 @@ def test_fail(path, py2_arg):
lines = fin.readlines()

errors = defaultdict(lambda: "")
for error_line in stdout.split("\n"):
error_lines = stdout.rstrip("\n").split("\n")
assert re.match(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now mypy always outputs at least one summary line; check that this line is as expected (in case it goes away in a later version) and then drop it.

r'Found \d+ errors? in \d+ files? \(checked \d+ source files?\)',
error_lines[-1].strip(),
)
for error_line in error_lines[:-1]:
error_line = error_line.strip()
if not error_line:
continue
Expand Down