Skip to content

Commit 0da2d13

Browse files
committed
Require mypy >= 1.0
1 parent d0daa50 commit 0da2d13

File tree

3 files changed

+14
-60
lines changed

3 files changed

+14
-60
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ requires-python = ">=3.7"
3232
dependencies = [
3333
"attrs>=19.0",
3434
"filelock>=3.0",
35-
"mypy>=0.50",
35+
"mypy>=1.0",
3636
"pytest>=4.6",
3737
]
3838

tests/test_pytest_mypy.py

+1-42
Original file line numberDiff line numberDiff line change
@@ -122,29 +122,6 @@ def pyfunc(x):
122122
return x * y
123123
""",
124124
)
125-
min_mypy_version = Version("0.990")
126-
if MYPY_VERSION < min_mypy_version:
127-
# mypy doesn't emit annotation-unchecked warnings until 0.990:
128-
fake_mypy_path = tmp_path / "mypy"
129-
fake_mypy_path.mkdir()
130-
(fake_mypy_path / "__init__.py").touch()
131-
(fake_mypy_path / "api.py").write_text(
132-
textwrap.dedent(
133-
"""
134-
def run(*args, **kwargs):
135-
return (
136-
"test_mypy_annotation_unchecked.py:2:"
137-
" note: By default the bodies of untyped functions"
138-
" are not checked, consider using --check-untyped-defs"
139-
" [annotation-unchecked]\\nSuccess: no issues found in"
140-
" 1 source file\\n",
141-
"",
142-
0,
143-
)
144-
"""
145-
)
146-
)
147-
monkeypatch.setenv("PYTHONPATH", str(tmp_path))
148125
result = testdir.runpytest_subprocess(*xdist_args)
149126
result.assert_outcomes()
150127
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
@@ -153,9 +130,7 @@ def run(*args, **kwargs):
153130
mypy_checks = mypy_file_checks + mypy_status_check
154131
outcomes = {"passed": mypy_checks}
155132
result.assert_outcomes(**outcomes)
156-
# mypy doesn't emit annotation-unchecked warnings until 0.990:
157-
if MYPY_VERSION >= Version("0.990"):
158-
result.stdout.fnmatch_lines(["*MypyWarning*"])
133+
result.stdout.fnmatch_lines(["*MypyWarning*"])
159134
assert result.ret == 0
160135

161136

@@ -409,10 +384,6 @@ def pytest_configure(config):
409384
assert result.ret != 0
410385

411386

412-
@pytest.mark.xfail(
413-
Version("0.900") > MYPY_VERSION,
414-
reason="Mypy added pyproject.toml configuration in 0.900.",
415-
)
416387
def test_pyproject_toml(testdir, xdist_args):
417388
"""Ensure that the plugin allows configuration with pyproject.toml."""
418389
testdir.makefile(
@@ -590,11 +561,6 @@ def test_mypy_item_collect(request):
590561
assert result.ret == 0
591562

592563

593-
@pytest.mark.xfail(
594-
MYPY_VERSION < Version("0.750"),
595-
raises=AssertionError,
596-
reason="https://github.com/python/mypy/issues/7800",
597-
)
598564
def test_mypy_results_from_mypy_with_opts():
599565
"""MypyResults.from_mypy respects passed options."""
600566
mypy_results = pytest_mypy.MypyResults.from_mypy([], opts=["--version"])
@@ -603,20 +569,13 @@ def test_mypy_results_from_mypy_with_opts():
603569
assert str(MYPY_VERSION) in mypy_results.stdout
604570

605571

606-
@pytest.mark.xfail(
607-
Version("3.7") < PYTHON_VERSION < Version("3.9")
608-
and Version("0.710") <= MYPY_VERSION < Version("0.720"),
609-
raises=AssertionError,
610-
reason="Mypy crashes for some reason.",
611-
)
612572
def test_mypy_no_output(testdir, xdist_args):
613573
"""No terminal summary is shown if there is no output from mypy."""
614574
type_ignore = (
615575
"# type: ignore"
616576
if (
617577
PYTEST_VERSION
618578
< Version("6.0") # Pytest didn't add type annotations until 6.0.
619-
or MYPY_VERSION < Version("0.710")
620579
)
621580
else ""
622581
)

tox.ini

+12-17
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
minversion = 4.4
44
isolated_build = true
55
envlist =
6-
py37-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.50, 0.x, 1.0, 1.x}
7-
py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.71, 0.x, 1.0, 1.x}
8-
py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.78, 0.x, 1.0, 1.x}
9-
py310-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.78, 0.x, 1.0, 1.x}
10-
py311-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.90, 0.x, 1.0, 1.x}
11-
py312-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.90, 0.x, 1.0, 1.x}
6+
py37-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{1.0, 1.x}
7+
py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
8+
py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
9+
py310-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
10+
py311-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
11+
py312-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
1212
publish
1313
static
1414

1515
[gh-actions]
1616
python =
17-
3.7: py37-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{0.50, 0.x, 1.0, 1.x}
18-
3.8: py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.71, 0.x, 1.0, 1.x}, publish, static
19-
3.9: py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.78, 0.x, 1.0, 1.x}
20-
3.10: py310-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.78, 0.x, 1.0, 1.x}
21-
3.11: py311-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.90, 0.x, 1.0, 1.x}
22-
3.12: py312-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{0.90, 0.x, 1.0, 1.x}
17+
3.7: py37-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x}-mypy{1.0, 1.x}
18+
3.8: py38-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}, publish, static
19+
3.9: py39-pytest{4.6, 5.0, 5.x, 6.0, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
20+
3.10: py310-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
21+
3.11: py311-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
22+
3.12: py312-pytest{6.2, 6.x, 7.0, 7.x, 8.0, 8.x}-mypy{1.0, 1.x}
2323

2424
[testenv]
2525
constrain_package_deps = true
@@ -34,11 +34,6 @@ deps =
3434
pytest7.x: pytest ~= 7.0
3535
pytest8.0: pytest ~= 8.0.0
3636
pytest8.x: pytest ~= 8.0
37-
mypy0.50: mypy >= 0.500, < 0.510
38-
mypy0.71: mypy >= 0.710, < 0.720
39-
mypy0.78: mypy >= 0.780, < 0.790
40-
mypy0.90: mypy >= 0.900, < 0.910
41-
mypy0.x: mypy ~= 0.0
4237
mypy1.0: mypy ~= 1.0.0
4338
mypy1.x: mypy ~= 1.0
4439

0 commit comments

Comments
 (0)