Skip to content

Commit 723c66b

Browse files
authored
Skip mypy install for pypy and mypy tests if it's not installed (#2905)
1 parent bf68bf8 commit 723c66b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

requirements_minimal.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ tbump~=6.11
66
coverage~=7.12
77
pytest
88
pytest-cov~=7.0
9-
mypy
9+
mypy; platform_python_implementation!="PyPy"

tests/test_raw_building.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from typing import Any
2020
from unittest import mock
2121

22-
import mypy.build
2322
import pytest
2423

2524
import tests.testdata.python3.data.fake_module_with_broken_getattr as fm_getattr
@@ -37,6 +36,13 @@
3736
object_build_class,
3837
)
3938

39+
try:
40+
import mypy.build
41+
42+
HAS_MYPY = True
43+
except ImportError:
44+
HAS_MYPY = False
45+
4046
DUMMY_MOD = build_module("DUMMY")
4147

4248

@@ -173,6 +179,7 @@ def mocked_sys_modules_getitem(name: str) -> types.ModuleType | CustomGetattr:
173179
assert not err
174180

175181

182+
@pytest.mark.skipif(not HAS_MYPY, reason="This test requires mypy")
176183
def test_missing__dict__():
177184
# This shouldn't raise an exception.
178185
object_build_class(DUMMY_MOD, mypy.build.ModuleNotFound)

0 commit comments

Comments
 (0)