Skip to content
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

Skip lxml and mypyc external tests against built wheels #11872

Merged
merged 1 commit into from
Dec 30, 2021
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
15 changes: 12 additions & 3 deletions misc/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,28 @@ def create_environ(python_version: str) -> Dict[str, str]:
'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=2 PIP_NO_BUILD_ISOLATION=no'
)

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

# pytest looks for configuration files in the parent directories of where the tests live.
# since we are trying to run the tests from their installed location, we copy those into
# the venv. Ew ew ew.
# We don't run tests that need lxml since we don't install lxml
# We don't run external mypyc tests since there's some issue with compilation on the
# manylinux image we use.
env['CIBW_TEST_COMMAND'] = """
(
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))')
&& TEST_DIRS=$(python -c 'import mypy.test; import mypyc.test; print(mypy.test.__path__[0], mypyc.test.__path__[0])')
&& cp '{project}/mypy/pytest.ini' '{project}/mypy/conftest.py' $DIR
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $TEST_DIRS

&& MYPY_TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])')
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $MYPY_TEST_DIR -k 'not (reports.test or testreports)'

&& MYPYC_TEST_DIR=$(python -c 'import mypyc.test; print(mypyc.test.__path__[0])')
&& pytest $MYPYC_TEST_DIR -k 'not test_external'
)
""".replace('\n', ' ')

Expand Down
4 changes: 2 additions & 2 deletions mypy/test/testreports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from mypy.test.helpers import Suite, assert_equal
from mypy.report import CoberturaPackage, get_line_rate

import lxml.etree as etree # type: ignore


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

def test_as_xml(self) -> None:
import lxml.etree as etree # type: ignore

cobertura_package = CoberturaPackage('foobar')
cobertura_package.covered_lines = 21
cobertura_package.total_lines = 42
Expand Down