8000 Xfail python/mypy#13701 by dmtucker · Pull Request #140 · realpython/pytest-mypy · GitHub
[go: up one dir, main page]

Skip to content

Xfail python/mypy#13701 #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022
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
18 changes: 14 additions & 4 deletions tests/test_pytest_mypy.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import signal
import textwrap

import mypy.version
from packaging.version import Version
import pexpect
import pytest


PYTEST_VERSION = tuple(int(v) for v in pytest.__version__.split(".")[:2])
MYPY_VERSION = Version(mypy.version.__version__)
PYTEST_VERSION = Version(pytest.__version__)


@pytest.fixture(
Expand Down Expand Up @@ -275,13 +278,18 @@ def pytest_configure(config):
assert result.ret == 0


@pytest.mark.xfail(
Version("0.971") <= MYPY_VERSION,
raises=AssertionError,
reason="https://github.com/python/mypy/issues/13701",
)
@pytest.mark.parametrize(
"module_name",
[
pytest.param(
"__init__",
marks=pytest.mark.xfail(
(3, 10) <= PYTEST_VERSION < (6, 2),
Version("3.10") <= PYTEST_VERSION < Version("6.2"),
raises=AssertionError,
reason="https://github.com/pytest-dev/pytest/issues/8016",
),
Expand Down Expand Up @@ -398,7 +406,7 @@ def pyfunc(x: int) -> str:
)

num_tests = 2
if module_name == "__init__" and (3, 10) <= PYTEST_VERSION < (6, 2):
if module_name == "__init__" and Version("3.10") <= PYTEST_VERSION < Version("6.2"):
# https://github.com/pytest-dev/pytest/issues/8016
# Pytest had a bug where it assumed only a Package would have a basename of
# __init__.py. In this test, Pytest mistakes MypyFile for a Package and
Expand Down Expand Up @@ -443,7 +451,9 @@ def _expect_success():
try:
child.expect(str(num_tests) + " passed")
except pexpect.exceptions.TIMEOUT:
if module_name == "__init__" and (6, 0) <= PYTEST_VERSION < (6, 2):
if module_name == "__init__" and (
Version("6.0") <= PYTEST_VERSION < Version("6.2")
):
# MypyItems hit the __init__.py bug too when --looponfail
# re-collects them after the failing file is modified.
# Unlike MypyFile, MypyItem is not a Collector, so this used
Expand Down
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ deps =
mypy0.81: mypy >= 0.810, < 0.820
mypy0.8x: mypy >= 0.800, < 0.900
mypy0.90: mypy >= 0.900, < 0.910
mypy0.91: mypy >= 0.910, < 0.920
mypy0.92: mypy >= 0.920, < 0.930
mypy0.93: mypy >= 0.930, < 0.940
mypy0.94: mypy >= 0.940, < 0.950
mypy0.95: mypy >= 0.950, < 0.960
mypy0.96: mypy >= 0.960, < 0.970
mypy0.97: mypy >= 0.970, < 0.980
mypy0.9x: mypy >= 0.900, <= 0.999

packaging ~= 21.3
pexpect ~= 4.8.0
pytest-cov ~= 2.10
pytest-randomly ~= 3.4
Expand Down
0