-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
mypy's built wheels includes two installable packages available after mypy is fully installed. They appear to not be practically usable:
import mypy.test
import mypyc.test
The testsuite depends on conftest.py and pyproject.toml from the root of the repository to run. Also, the test-data/ directory provides data the tests need. None of this data is distributed in the built wheels.
The fact that the packages are installed at all appears to be a bug. This is a side effect of #2784 which requested that the sdist (not the wheel) include the testsuite so that redistributors such as Debian can run the tests when packaging.
The intertwining of the testsuite as part of the mypy module alongside the requirement to use data from the sources makes it difficult to test mypy correctly. Allowing the tests to be detected by pytest means making the mypy/ directory importable and causes the tests to incorrectly run against the pure-python version, which means the compiled extensions do not get tested.
And mypy's own CI is working around this with editable installs:
mypy/.github/workflows/test.yml
Lines 137 to 145 in 9b91524
- name: Compiled with mypyc | |
if: ${{ matrix.test_mypyc }} | |
run: | | |
pip install -r test-requirements.txt | |
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e . | |
- name: Setup tox environment | |
run: tox run -e ${{ matrix.toxenv }} --notest | |
- name: Test | |
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }} |
Also, the installation footprint of these unused files seems to be a couple of MB, which could be a nice optimization...