Skip to content

Commit a0403f1

Browse files
msullivanPattenR
authored andcommitted
Add a CI build that uses mypyc (python#6869)
Closes python#6170
1 parent 97d0b12 commit a0403f1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dist: xenial
1010
env:
1111
TOXENV=py
1212
EXTRA_ARGS="-n 12"
13+
TEST_MYPYC=0
1314

1415
jobs:
1516
include:
@@ -34,6 +35,12 @@ jobs:
3435
- TOXENV=py
3536
- EXTRA_ARGS="-n 12"
3637
- NEWSEMANAL=1
38+
- name: "run test suite with python 3.7 (compiled with mypyc)"
39+
python: 3.7
40+
env:
41+
- TOXENV=py
42+
- EXTRA_ARGS="-n 12"
43+
- TEST_MYPYC=1
3744
- name: "run test suite with python 3.8-dev"
3845
python: 3.8-dev
3946
- name: "type check our own code"
@@ -64,6 +71,11 @@ install:
6471
- pip install -U pip setuptools
6572
- pip install -U tox==3.9.0
6673
- tox --notest
74+
# This is a big hack and only works because the layout of our directories
75+
# means that tox picks up the mypy from the source directories instead of
76+
# the version it installed into a venv. This is also *why* we need to do this,
77+
# since if we arranged for tox to build with mypyc, pytest wouldn't use it.
78+
- 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
6779

6880
script:
6981
- tox -- $EXTRA_ARGS

mypy/test/testmypyc.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""A basic check to make sure that we are using a mypyc-compiled version when expected."""
2+
3+
import mypy
4+
5+
from unittest import TestCase
6+
import os
7+
8+
9+
class MypycTest(TestCase):
10+
def test_using_mypyc(self) -> None:
11+
if os.getenv('TEST_MYPYC', None) == '1':
12+
assert not mypy.__file__.endswith('.py'), "Expected to find a mypyc-compiled version"

0 commit comments

Comments
 (0)