diff --git a/.travis.yml b/.travis.yml index 882737fc7c53c..32a35205c63bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ dist: xenial env: TOXENV=py EXTRA_ARGS="-n 12" + TEST_MYPYC=0 jobs: include: @@ -34,6 +35,12 @@ jobs: - TOXENV=py - EXTRA_ARGS="-n 12" - NEWSEMANAL=1 + - name: "run test suite with python 3.7 (compiled with mypyc)" + python: 3.7 + env: + - TOXENV=py + - EXTRA_ARGS="-n 12" + - TEST_MYPYC=1 - name: "run test suite with python 3.8-dev" python: 3.8-dev - name: "type check our own code" @@ -64,6 +71,11 @@ install: - pip install -U pip setuptools - pip install -U tox==3.9.0 - tox --notest +# This is a big hack and only works because the layout of our directories +# means that tox picks up the mypy from the source directories instead of +# the version it installed into a venv. This is also *why* we need to do this, +# since if we arranged for tox to build with mypyc, pytest wouldn't use it. +- if [[ $TEST_MYPYC == 1 ]]; then pip install -r mypyc-requirements.txt; CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace; fi script: - tox -- $EXTRA_ARGS diff --git a/mypy/test/testmypyc.py b/mypy/test/testmypyc.py new file mode 100644 index 0000000000000..b66ec9e5ccf3f --- /dev/null +++ b/mypy/test/testmypyc.py @@ -0,0 +1,12 @@ +"""A basic check to make sure that we are using a mypyc-compiled version when expected.""" + +import mypy + +from unittest import TestCase +import os + + +class MypycTest(TestCase): + def test_using_mypyc(self) -> None: + if os.getenv('TEST_MYPYC', None) == '1': + assert not mypy.__file__.endswith('.py'), "Expected to find a mypyc-compiled version"