Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dist: xenial
env:
TOXENV=py
EXTRA_ARGS="-n 12"
TEST_MYPYC=0

jobs:
include:
Expand All @@ -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"
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions mypy/test/testmypyc.py
Original file line number Diff line number Diff line change
@@ -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"