diff --git a/.ci/mitogen_py24_install.py b/.ci/mitogen_py24_install.py new file mode 100755 index 00000000..97370806 --- /dev/null +++ b/.ci/mitogen_py24_install.py @@ -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) diff --git a/.ci/mitogen_py24_tests.py b/.ci/mitogen_py24_tests.py new file mode 100755 index 00000000..228e79bd --- /dev/null +++ b/.ci/mitogen_py24_tests.py @@ -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') diff --git a/run_tests b/run_tests index 8de99ace..9ffeab17 100755 --- a/run_tests +++ b/run_tests @@ -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"