issue #477: add mitogen_py24 CI test type.

Butcher the crap out of run_tests because we don't have/want/need
coverage on 2.4.
This commit is contained in:
David Wilson 2019-01-23 12:44:08 +00:00
parent 767331d76f
commit cab0b2cb9a
3 changed files with 59 additions and 12 deletions

14
.ci/mitogen_py24_install.py Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
import ci_lib
batches = [
[
'docker pull %s' % (ci_lib.image_for_distro(ci_lib.DISTRO),),
],
[
'sudo tar -C / -jxvf tests/data/ubuntu-python-2.4.6.tar.bz2',
]
]
ci_lib.run_batches(batches)

17
.ci/mitogen_py24_tests.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
# Mitogen tests for Python 2.4.
import os
import ci_lib
os.environ.update({
'NOCOVERAGE': '1',
'UNIT2': '/usr/local/python2.4.6/bin/unit2',
'MITOGEN_TEST_DISTRO': ci_lib.DISTRO,
'MITOGEN_LOG_LEVEL': 'debug',
'SKIP_ANSIBLE': '1',
})
ci_lib.run('./run_tests -v')

View File

@ -8,16 +8,25 @@ echo
set -o errexit
set -o pipefail
UNIT2="$(which unit2)"
if [ ! "$UNIT2" ]; then
UNIT2="$(which unit2)"
fi
coverage erase
[ "$NOCOVERAGE" ] || coverage erase
# First run overwites coverage output.
[ "$SKIP_MITOGEN" ] || {
coverage run "${UNIT2}" discover \
--start-directory "tests" \
--pattern '*_test.py' \
"$@"
if [ ! "$NOCOVERAGE" ]; then
coverage run "${UNIT2}" discover \
--start-directory "tests" \
--pattern '*_test.py' \
"$@"
else
"${UNIT2}" discover \
--start-directory "tests" \
--pattern '*_test.py' \
"$@"
fi
}
# Second run appends. This is since 'discover' treats subdirs as packages and
@ -27,11 +36,18 @@ coverage erase
# mess of Git history.
[ "$SKIP_ANSIBLE" ] || {
export PYTHONPATH=`pwd`/tests:$PYTHONPATH
coverage run -a "${UNIT2}" discover \
--start-directory "tests/ansible" \
--pattern '*_test.py' \
"$@"
if [ ! "$NOCOVERAGE" ]; then
coverage run -a "${UNIT2}" discover \
--start-directory "tests/ansible" \
--pattern '*_test.py' \
"$@"
else
coverage run -a "${UNIT2}" discover \
--start-directory "tests/ansible" \
--pattern '*_test.py' \
"$@"
fi
}
coverage html
echo coverage report is at "file://$(pwd)/htmlcov/index.html"
[ "$NOCOVERAGE" ] || coverage html
[ "$NOCOVERAGE" ] || echo coverage report is at "file://$(pwd)/htmlcov/index.html"