19
19
run_tests=" bin/py.test --pyargs ${module} "
20
20
pipver=20.3b1 # minimum required version of pip for Python 3.9
21
21
setuptoolsver=41.1.0 # required for Python 3.9
22
- PYVER=${PYVER:= 3}
22
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null && pwd ) "
23
+
24
+ rm -Rf testenv? || /bin/true
23
25
24
- rm -Rf " testenv${PYVER} _" ? || /bin/true
25
26
26
27
if [ " ${RELEASE_SKIP} " != " head" ]
27
28
then
28
- " python ${PYVER} " -m venv " testenv ${PYVER} _1 "
29
+ python3 -m venv testenv1
29
30
# First we test the head
30
31
# shellcheck source=/dev/null
31
- source " testenv${PYVER} _1/bin/activate"
32
- rm -f " testenv${PYVER} _1/lib/python-wheels/setuptools" *
33
- pip install --force-reinstall -U pip==${pipver}
34
- pip install setuptools==${setuptoolsver} wheel
35
- pip install pytest\< 7 pytest-xdist -rrequirements.txt
32
+ source testenv1/bin/activate
33
+ rm -Rf testenv1/local
34
+ rm -f testenv1/lib/python-wheels/setuptools* \
35
+ && pip install --force-reinstall -U pip==${pipver} \
36
+ && pip install setuptools==${setuptoolsver} wheel
37
+ pip install -rtest-requirements.txt
36
38
make test
37
- pip uninstall -y ${package} || true ; pip uninstall -y ${package} \
38
- || true ; make install
39
- mkdir " testenv${PYVER} _1/not-${module} "
39
+ pip uninstall -y ${package} || true ; pip uninstall -y ${package} || true ; make install
40
+ mkdir testenv1/not-${module}
40
41
# if there is a subdir named '${module}' py.test will execute tests
41
42
# there instead of the installed module's tests
42
-
43
- pushd " testenv${PYVER} _1/not-${module} "
43
+ pushd testenv1/not-${module}
44
44
# shellcheck disable=SC2086
45
45
../${run_tests} ; popd
46
46
fi
47
47
48
-
49
- " python${PYVER} " -m venv " testenv${PYVER} _2"
50
- " python${PYVER} " -m venv " testenv${PYVER} _3"
51
- " python${PYVER} " -m venv " testenv${PYVER} _4"
52
- " python${PYVER} " -m venv " testenv${PYVER} _5"
53
-
48
+ python3 -m venv testenv2
49
+ python3 -m venv testenv3
50
+ python3 -m venv testenv4
51
+ python3 -m venv testenv5
52
+ rm -Rf testenv[2345]/local
54
53
55
54
# Secondly we test via pip
56
55
57
- pushd " testenv ${PYVER} _2 "
56
+ pushd testenv2
58
57
# shellcheck source=/dev/null
59
58
source bin/activate
60
59
rm -f lib/python-wheels/setuptools* \
@@ -63,28 +62,29 @@ rm -f lib/python-wheels/setuptools* \
63
62
# The following can fail if you haven't pushed your commits to ${repo}
64
63
pip install -e " git+${repo} @${HEAD} #egg=${package} "
65
64
pushd src/${package}
66
- pip install pytest \< 7 pytest-xdist
65
+ pip install -rtest-requirements.txt
67
66
make dist
68
67
make test
69
- cp dist/${package} * tar.gz " ../../../testenv ${PYVER} _3/ "
70
- cp dist/${module} * whl " ../../../testenv ${PYVER} _4/ "
68
+ cp dist/${package} * tar.gz ../../../testenv3/
69
+ cp dist/${module} * whl ../../../testenv4/
71
70
pip uninstall -y ${package} || true ; pip uninstall -y ${package} || true ; make install
72
71
popd # ../.. no subdir named ${proj} here, safe for py.testing the installed module
73
72
# shellcheck disable=SC2086
74
73
${run_tests}
75
74
popd
76
75
77
- # Is the source distribution in testenv${PYVER}_2 complete enough to build
76
+ # Is the source distribution in testenv2 complete enough to build
78
77
# another functional distribution?
79
78
80
- pushd " testenv ${PYVER} _3/ "
79
+ pushd testenv3/
81
80
# shellcheck source=/dev/null
82
81
source bin/activate
83
82
rm -f lib/python-wheels/setuptools* \
84
83
&& pip install --force-reinstall -U pip==${pipver} \
85
84
&& pip install setuptools==${setuptoolsver} wheel
86
- pip install ${package} * tar.gz
87
- pip install pytest\< 7 pytest-xdist
85
+ package_tar=$( find . -name " ${package} *tar.gz" )
86
+ pip install " -r${DIR} /test-requirements.txt"
87
+ pip install " ${package_tar} "
88
88
mkdir out
89
89
tar --extract --directory=out -z -f ${package} * .tar.gz
90
90
pushd out/${package} *
@@ -98,16 +98,16 @@ pushd ../not-${module}
98
98
popd
99
99
popd
100
100
101
- # Is the wheel in testenv${PYVER}_2 installable and will it pass the tests
101
+ # Is the wheel in testenv2 installable and will it pass the tests
102
102
103
- pushd " testenv ${PYVER} _4/ "
103
+ pushd testenv4/
104
104
# shellcheck source=/dev/null
105
105
source bin/activate
106
106
rm -f lib/python-wheels/setuptools* \
107
107
&& pip install --force-reinstall -U pip==${pipver} \
108
108
&& pip install setuptools==${setuptoolsver} wheel
109
109
pip install ${module} * .whl
110
- pip install pytest \< 7 pytest-xdist
110
+ pip install " -r ${DIR} /test-requirements.txt "
111
111
mkdir not-${module}
112
112
pushd not-${module}
113
113
# shellcheck disable=SC2086
0 commit comments