Skip to content

Commit 48ebbb7

Browse files
committed
add release tester
1 parent 068594e commit 48ebbb7

File tree

4 files changed

+123
-1
lines changed

4 files changed

+123
-1
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

MANIFEST.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,22 @@ recursive-include scripts *
22
recursive-include test-data *
33
recursive-include extensions *
44
recursive-include docs *
5+
recursive-include misc proper_plugin.py
56
recursive-include mypy/typeshed *.py *.pyi
67
recursive-include mypy/xml *.xsd *.xslt *.css
7-
recursive-include mypyc/lib-rt *.c *.h *.tmpl
8+
recursive-include mypyc/lib-rt *.c *.h *.tmpl *.py *.cc
89
recursive-include mypyc/ir *.py
910
recursive-include mypyc/codegen *.py
1011
recursive-include mypyc/irbuild *.py
1112
recursive-include mypyc/primitives *.py
1213
recursive-include mypyc/transform *.py
14+
recursive-include mypyc/external *.cc *.h Makefile *.pump LICENSE README
1315
recursive-include mypyc/test *.py
1416
recursive-include mypyc/test-data *.test
1517
recursive-include mypyc/test-data/fixtures *.py *.pyi
1618
recursive-include mypyc/doc *.rst *.py *.md Makefile *.bat
1719
include mypy_bootstrap.ini
1820
include mypy_self_check.ini
1921
include LICENSE
22+
include runtests.py
23+
include pytest.ini

misc/release-test.sh

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

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# testpaths is new in 2.8
33
minversion = 2.8
44

5+
# Are you updating anything in this file? Then update misc/release-test.sh as well
6+
# Thanks!
7+
58
testpaths = mypy/test mypyc/test
69

710
python_files = test*.py

0 commit comments

Comments
 (0)