diff --git a/test-requirements.txt b/test-requirements.txt index edabce2..104aec3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tests/test_stubs.py b/tests/test_stubs.py index de16b90..a90cdf7 100644 --- a/tests/test_stubs.py +++ b/tests/test_stubs.py @@ -1,4 +1,5 @@ import os +import re from collections import defaultdict import pytest @@ -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)) @@ -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( + 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