-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
export LC_ALL=C | ||
export TEST_MYPYC=1 | ||
export MYPY_USE_MYPYC=1 | ||
export CC=clang MYPYC_OPT_LEVEL=0 | ||
|
||
package=mypy | ||
module=mypy | ||
slug=${TRAVIS_PULL_REQUEST_SLUG:=python/mypy} | ||
repo=https://github.com/${slug}.git | ||
test_prefix="" | ||
run_tests() { | ||
"${test_prefix}bin/py.test" --pyarg -x ${module} -n auto --dist=loadfile | ||
} | ||
pipver=7.1.0 # minimum required version of pip given python3.6+ | ||
setuptoolsver=24.2.0 # required to generate correct metadata for | ||
# python_requires | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null && pwd )" | ||
|
||
rm -Rf testenv? || /bin/true | ||
|
||
export HEAD=${TRAVIS_PULL_REQUEST_SHA:-$(git rev-parse HEAD)} | ||
|
||
if [ "${RELEASE_SKIP}" != "head" ] | ||
then | ||
virtualenv testenv1 -p python3 | ||
# First we test the head | ||
# shellcheck source=/dev/null | ||
source testenv1/bin/activate | ||
rm -Rf testenv1/local | ||
rm -f testenv1/lib/python-wheels/setuptools* \ | ||
&& pip install --force-reinstall -U pip==${pipver} \ | ||
&& pip install setuptools==${setuptoolsver} wheel | ||
pip install -rmypy-requirements.txt | ||
pip install -rtest-requirements.txt | ||
python setup.py build_ext | ||
./runtests.py | ||
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install . | ||
mkdir testenv1/not-${module} | ||
# if there is a subdir named '${module}' py.test will execute tests | ||
# there instead of the installed module's tests | ||
pushd testenv1/not-${module} | ||
# shellcheck disable=SC2086 | ||
test_prefix=../ run_tests; popd | ||
fi | ||
|
||
virtualenv testenv2 -p python3 | ||
virtualenv testenv3 -p python3 | ||
virtualenv testenv4 -p python3 | ||
rm -Rf testenv[234]/local | ||
|
||
# Secondly we test via pip | ||
|
||
cd testenv2 | ||
# shellcheck source=/dev/null | ||
source bin/activate | ||
rm -f lib/python-wheels/setuptools* \ | ||
&& pip install --force-reinstall -U pip==${pipver} \ | ||
&& pip install setuptools==${setuptoolsver} wheel typing_extensions | ||
pip install -e "git+${repo}@${HEAD}#egg=${package}" | ||
cd src/${package} | ||
pip install -rmypy-requirements.txt | ||
pip install -rtest-requirements.txt | ||
python setup.py sdist bdist_wheel | ||
./runtests.py | ||
cp dist/${package}*tar.gz ../../../testenv3/ | ||
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install . | ||
cd ../.. # no subdir named ${proj} here, safe for py.testing the installed module | ||
# shellcheck disable=SC2086 | ||
run_tests | ||
|
||
# Is the distribution in testenv2 complete enough to build another | ||
# functional distribution? | ||
|
||
cd ../testenv3/ | ||
# shellcheck source=/dev/null | ||
source bin/activate | ||
rm -f lib/python-wheels/setuptools* \ | ||
&& pip install --force-reinstall -U pip==${pipver} \ | ||
&& pip install setuptools==${setuptoolsver} wheel | ||
pip install "-r${DIR}/mypy-requirements.txt" | ||
pip install "-r${DIR}/test-requirements.txt" | ||
pip install ${package}*tar.gz | ||
mkdir out | ||
tar --extract --directory=out -z -f ${package}*.tar.gz | ||
cd out/${package}* | ||
python setup.py sdist bdist_wheel | ||
./runtests.py | ||
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install . | ||
mkdir ../not-${module} | ||
pushd ../not-${module} | ||
# shellcheck disable=SC2086 | ||
test_prefix=../../ run_tests; popd |