Skip to content

Commit 259f048

Browse files
hauntsaninjaJukkaL
authored andcommitted
Skip lxml and mypyc external tests against built wheels (#11872)
Co-authored-by: hauntsaninja <>
1 parent 5bf5eda commit 259f048

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

misc/build_wheel.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,28 @@ def create_environ(python_version: str) -> Dict[str, str]:
7373
'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=2 PIP_NO_BUILD_ISOLATION=no'
7474
)
7575

76+
# lxml doesn't have a wheel for Python 3.10 on the manylinux image we use.
77+
# lxml has historically been slow to support new Pythons as well.
7678
env['CIBW_BEFORE_TEST'] = (
77-
'pip install -r {project}/mypy/test-requirements.txt'
79+
'pip install -r <(grep -v lxml {project}/mypy/test-requirements.txt)'
7880
)
7981

8082
# pytest looks for configuration files in the parent directories of where the tests live.
8183
# since we are trying to run the tests from their installed location, we copy those into
8284
# the venv. Ew ew ew.
85+
# We don't run tests that need lxml since we don't install lxml
86+
# We don't run external mypyc tests since there's some issue with compilation on the
87+
# manylinux image we use.
8388
env['CIBW_TEST_COMMAND'] = """
8489
(
8590
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))')
86-
&& TEST_DIRS=$(python -c 'import mypy.test; import mypyc.test; print(mypy.test.__path__[0], mypyc.test.__path__[0])')
8791
&& cp '{project}/mypy/pytest.ini' '{project}/mypy/conftest.py' $DIR
88-
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $TEST_DIRS
92+
93+
&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])')
94+
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR -k 'not (reports.test or testreports)'
95+
96+
&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])')
97+
&& pytest $MYPYC_TEST_DIR -k 'not test_external'
8998
)
9099
""".replace('\n', ' ')
91100

mypy/test/testreports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from mypy.test.helpers import Suite, assert_equal
55
from mypy.report import CoberturaPackage, get_line_rate
66

7-
import lxml.etree as etree # type: ignore
8-
97

108
class CoberturaReportSuite(Suite):
119
def test_get_line_rate(self) -> None:
1210
assert_equal('1.0', get_line_rate(0, 0))
1311
assert_equal('0.3333', get_line_rate(1, 3))
1412

1513
def test_as_xml(self) -> None:
14+
import lxml.etree as etree # type: ignore
15+
1616
cobertura_package = CoberturaPackage('foobar')
1717
cobertura_package.covered_lines = 21
1818
cobertura_package.total_lines = 42

0 commit comments

Comments
 (0)