Skip to content

Commit a667de5

Browse files
committed
add release tester
1 parent a3b5933 commit a667de5

File tree

4 files changed

+122
-1
lines changed

4 files changed

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