Skip to content

Commit f44302f

Browse files
committed
add release tester
1 parent 8cc06b7 commit f44302f

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ jobs:
8080
# env:
8181
# - TOXENV=dev
8282
# - EXTRA_ARGS=
83+
- name: "check MANIFEST.in completeness"
84+
python: 3.7
85+
install: ""
86+
script: RELEASE_SKIP=head ${TRAVIS_BUILD_DIR}/misc/release-test.sh
8387
allow_failures:
8488
- name: "run test suite with python 3.9"
8589
python: 3.9-dev

misc/release-test.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
export LC_ALL=C
7+
export TEST_MYPYC=1
8+
export MYPY_USE_MYPYC=1
9+
export CC=clang MYPYC_OPT_LEVEL=0
10+
11+
package=mypy
12+
module=mypy
13+
slug=${TRAVIS_PULL_REQUEST_SLUG:=python/mypy}
14+
repo=https://github.com/${slug}.git
15+
test_prefix=""
16+
run_tests() {
17+
"${test_prefix}bin/py.test" --pyarg -x ${module} -n auto --dist=loadfile
18+
}
19+
pipver=7.1.0 # minimum required version of pip given python3.6+
20+
setuptoolsver=24.2.0 # required to generate correct metadata for
21+
# python_requires
22+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null && pwd )"
23+
24+
rm -Rf testenv? || /bin/true
25+
26+
export HEAD=${TRAVIS_PULL_REQUEST_SHA:-$(git rev-parse HEAD)}
27+
28+
if [ "${RELEASE_SKIP}" != "head" ]
29+
then
30+
virtualenv testenv1 -p python3
31+
# First we test the head
32+
# shellcheck source=/dev/null
33+
source testenv1/bin/activate
34+
rm -Rf testenv1/local
35+
rm -f testenv1/lib/python-wheels/setuptools* \
36+
&& pip install --force-reinstall -U pip==${pipver} \
37+
&& pip install setuptools==${setuptoolsver} wheel
38+
pip install -rmypy-requirements.txt
39+
pip install -rtest-requirements.txt
40+
python setup.py build_ext
41+
./runtests.py
42+
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install .
43+
mkdir testenv1/not-${module}
44+
# if there is a subdir named '${module}' py.test will execute tests
45+
# there instead of the installed module's tests
46+
pushd testenv1/not-${module}
47+
# shellcheck disable=SC2086
48+
test_prefix=../ run_tests; popd
49+
fi
50+
51+
virtualenv testenv2 -p python3
52+
virtualenv testenv3 -p python3
53+
virtualenv testenv4 -p python3
54+
rm -Rf testenv[234]/local
55+
56+
# Secondly we test via pip
57+
58+
cd testenv2
59+
# shellcheck source=/dev/null
60+
source bin/activate
61+
rm lib/python-wheels/setuptools* \
62+
&& pip install --force-reinstall -U pip==${pipver} \
63+
&& pip install setuptools==${setuptoolsver} wheel typing_extensions
64+
pip install -e "git+${repo}@${HEAD}#egg=${package}"
65+
cd src/${package}
66+
pip install -rmypy-requirements.txt
67+
pip install -rtest-requirements.txt
68+
python setup.py sdist bdist_wheel
69+
./runtests.py
70+
cp dist/${package}*tar.gz ../../../testenv3/
71+
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install .
72+
cd ../.. # no subdir named ${proj} here, safe for py.testing the installed module
73+
# shellcheck disable=SC2086
74+
run_tests
75+
76+
# Is the distribution in testenv2 complete enough to build another
77+
# functional distribution?
78+
79+
cd ../testenv3/
80+
# shellcheck source=/dev/null
81+
source bin/activate
82+
rm lib/python-wheels/setuptools* \
83+
&& pip install --force-reinstall -U pip==${pipver} \
84+
&& pip install setuptools==${setuptoolsver} wheel
85+
pip install "-r${DIR}/mypy-requirements.txt"
86+
pip install "-r${DIR}/test-requirements.txt"
87+
pip install ${package}*tar.gz
88+
mkdir out
89+
tar --extract --directory=out -z -f ${package}*.tar.gz
90+
cd out/${package}*
91+
python setup.py sdist bdist_wheel
92+
./runtests.py
93+
pip uninstall -y ${package} || true; pip uninstall -y ${package} || true; pip install .
94+
mkdir ../not-${module}
95+
pushd ../not-${module}
96+
# shellcheck disable=SC2086
97+
test_prefix=../../ run_tests; popd

0 commit comments

Comments
 (0)