From 3d205764fff2ca792886d84d0a16791dfd33f077 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:54:27 -0600 Subject: [PATCH] Run mypyc tests against built wheels (#11865) This should catch https://github.com/mypyc/mypyc/issues/912 We never ran mypyc tests against wheels, dating back to https://github.com/python/mypy/tree/783297c9b4ed3b2af9000c3536d6e1be34fed9ea/misc Co-authored-by: hauntsaninja <> --- misc/build_wheel.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/misc/build_wheel.py b/misc/build_wheel.py index 44b40c2e8fed..4c923279742e 100644 --- a/misc/build_wheel.py +++ b/misc/build_wheel.py @@ -73,21 +73,19 @@ 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', ' ') @@ -95,7 +93,7 @@ def create_environ(python_version: str) -> Dict[str, str]: # 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