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

Run mypyc tests against built wheels #11865

Merged
merged 1 commit into from
Dec 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions misc/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,27 @@ def create_environ(python_version: str) -> Dict[str, str]:
'MYPY_USE_MYPYC=1 MYPYC_OPT_LEVEL=2 PIP_NO_BUILD_ISOLATION=no'
)

# lxml is slow to build wheels for new releases, so allow installing reqs to fail
# if we failed to install lxml, we'll skip tests, but allow the build to succeed
env['CIBW_BEFORE_TEST'] = (
'pip install -r {project}/mypy/test-requirements.txt || true'
'pip install -r {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.
env['CIBW_TEST_COMMAND'] = """
( ! pip list | grep lxml ) || (
(
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))')
&& TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__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_DIR
&& MYPY_TEST_PREFIX='{project}/mypy' pytest $TEST_DIRS
)
""".replace('\n', ' ')

# i ran into some flaky tests on windows, so only run testcheck. it looks like we
# previously didn't run any tests on windows wheels, so this is a net win.
env['CIBW_TEST_COMMAND_WINDOWS'] = """
bash -c "
( ! pip list | grep lxml ) || (
(
DIR=$(python -c 'import mypy, os; dn = os.path.dirname; print(dn(dn(mypy.__path__[0])))')
&& TEST_DIR=$(python -c 'import mypy.test; print(mypy.test.__path__[0])')
&& cp '{project}/mypy/pytest.ini' '{project}/mypy/conftest.py' $DIR
Expand Down