From 4838914a1e31055dc3d742097e5075b9fae37f31 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 25 Mar 2020 19:21:25 -0700 Subject: [PATCH] MAINT: upgrade mypy to 0.770 (the latest) The most significant benefit is changes to `@overload` around what counts as overlapping signatures that could unlock some functionality; see e.g. - https://github.com/numpy/numpy-stubs/pull/44#discussion_r396186738 - https://github.com/numpy/numpy-stubs/pull/11#issuecomment-369444243 --- test-requirements.txt | 2 +- tests/test_stubs.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) 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