Skip to content

Commit 7575b64

Browse files
authored
Merge pull request #140 from dmtucker/mypy13701
Xfail python/mypy#13701
2 parents 9710ab4 + 3e6c6e5 commit 7575b64

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

tests/test_pytest_mypy.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import signal
22
import textwrap
33

4+
import mypy.version
5+
from packaging.version import Version
46
import pexpect
57
import pytest
68

79

8-
PYTEST_VERSION = tuple(int(v) for v in pytest.__version__.split(".")[:2])
10+
MYPY_VERSION = Version(mypy.version.__version__)
11+
PYTEST_VERSION = Version(pytest.__version__)
912

1013

1114
@pytest.fixture(
@@ -275,13 +278,18 @@ def pytest_configure(config):
275278
assert result.ret == 0
276279

277280

281+
@pytest.mark.xfail(
282+
Version("0.971") <= MYPY_VERSION,
283+
raises=AssertionError,
284+
reason="https://github.com/python/mypy/issues/13701",
285+
)
278286
@pytest.mark.parametrize(
279287
"module_name",
280288
[
281289
pytest.param(
282290
"__init__",
283291
marks=pytest.mark.xfail(
284-
(3, 10) <= PYTEST_VERSION < (6, 2),
292+
Version("3.10") <= PYTEST_VERSION < Version("6.2"),
285293
raises=AssertionError,
286294
reason="https://github.com/pytest-dev/pytest/issues/8016",
287295
),
@@ -398,7 +406,7 @@ def pyfunc(x: int) -> str:
398406
)
399407

400408
num_tests = 2
401-
if module_name == "__init__" and (3, 10) <= PYTEST_VERSION < (6, 2):
409+
if module_name == "__init__" and Version("3.10") <= PYTEST_VERSION < Version("6.2"):
402410
# https://github.com/pytest-dev/pytest/issues/8016
403411
# Pytest had a bug where it assumed only a Package would have a basename of
404412
# __init__.py. In this test, Pytest mistakes MypyFile for a Package and
@@ -443,7 +451,9 @@ def _expect_success():
443451
try:
444452
child.expect(str(num_tests) + " passed")
445453
except pexpect.exceptions.TIMEOUT:
446-
if module_name == "__init__" and (6, 0) <= PYTEST_VERSION < (6, 2):
454+
if module_name == "__init__" and (
455+
Version("6.0") <= PYTEST_VERSION < Version("6.2")
456+
):
447457
# MypyItems hit the __init__.py bug too when --looponfail
448458
# re-collects them after the failing file is modified.
449459
# Unlike MypyFile, MypyItem is not a Collector, so this used

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ deps =
6464
mypy0.81: mypy >= 0.810, < 0.820
6565
mypy0.8x: mypy >= 0.800, < 0.900
6666
mypy0.90: mypy >= 0.900, < 0.910
67+
mypy0.91: mypy >= 0.910, < 0.920
68+
mypy0.92: mypy >= 0.920, < 0.930
69+
mypy0.93: mypy >= 0.930, < 0.940
70+
mypy0.94: mypy >= 0.940, < 0.950
71+
mypy0.95: mypy >= 0.950, < 0.960
72+
mypy0.96: mypy >= 0.960, < 0.970
73+
mypy0.97: mypy >= 0.970, < 0.980
6774
mypy0.9x: mypy >= 0.900, <= 0.999
6875

76+
packaging ~= 21.3
6977
pexpect ~= 4.8.0
7078
pytest-cov ~= 2.10
7179
pytest-randomly ~= 3.4

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy