summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Quast <contact@jeffquast.com>2016-02-14 13:43:13 -0800
committerJeff Quast <contact@jeffquast.com>2016-02-14 13:43:13 -0800
commit12e60fadaa0f934357e6a7e0bbf3087768b81c44 (patch)
tree2b4b74cf6aa35efb4f03400c67d09e70f52fef9d
parent0f3fb5c9d52aa1126966e90ac23b38820cf809da (diff)
downloadpexpect-12e60fadaa0f934357e6a7e0bbf3087768b81c44.tar.gz
add py3.5-specific make_wheel_for_ptyprocess stage
move everything into functions, should help manage this complexity a bit more until we can find a tox-like fix
-rwxr-xr-xtools/teamcity-runtests.sh109
1 files changed, 67 insertions, 42 deletions
diff --git a/tools/teamcity-runtests.sh b/tools/teamcity-runtests.sh
index 16b5991..7a17267 100755
--- a/tools/teamcity-runtests.sh
+++ b/tools/teamcity-runtests.sh
@@ -6,7 +6,7 @@ set -e
set -o pipefail
if [ -z $1 ]; then
- echo "$0 (2.6|2.7|3.3|3.4)"
+ echo "$0 (2.6|2.7|3.3|3.4|3.5)"
exit 1
fi
@@ -14,56 +14,81 @@ export PYTHONIOENCODING=UTF8
export LANG=en_US.UTF-8
pyversion=$1
+pyversion_flit=3.5
shift
here=$(cd `dirname $0`; pwd)
osrel=$(uname -s)
venv=teamcity-pexpect
-venv_wrapper=$(which virtualenvwrapper.sh)
+venv_flit=flit-builder
-if [ -z $venv_wrapper ]; then
- echo "virtualenvwrapper.sh not found in PATH." >&2
- exit 1
-fi
-. ${venv_wrapper}
-rmvirtualenv ${venv} || true
-mkvirtualenv -p `which python${pyversion}` ${venv} || true
-workon ${venv}
+function prepare_virtualenvwrapper() {
+ venv_wrapper=$(which virtualenvwrapper.sh)
+ . ${venv_wrapper}
+ if [ -z $venv_wrapper ]; then
+ echo "virtualenvwrapper.sh not found in PATH." >&2
+ exit 1
+ fi
+}
-# install ptyprocess
-cd $here/../../ptyprocess
-pip uninstall --yes ptyprocess || true
-# ptyprocess is without any setup.py, we must install 'flit'
-# with the given 'flit.ini' for 'pip install -e.' equivalent
-# (Directory '.' is not installable. File 'setup.py' not found).
-pip install --upgrade flit || true
-flit -f flit.ini install || true
-# install all test requirements
-pip install --upgrade pytest-cov coverage coveralls pytest-capturelog
+function make_wheel_for_ptyprocess() {
+ mkvirtualenv -p`which python${version_flit}` ${venv_flit} || true
+ workon ${venv_flit}
+ # explicitly use pip3.5 to install/upgrade flit, a dependency for building
+ # the ptyprocess wheel package. Flit is not compatible with python 2.7.
+ pip${version_flit} install --upgrade flit
-# run tests
-cd $here/..
-ret=0
-py.test \
- --cov pexpect \
- --cov-config .coveragerc \
- --junit-xml=results.${osrel}.py${pyversion}.xml \
- --verbose \
- --verbose \
- "$@" || ret=$?
+ # create ptyprocess wheel
+ cd $here/../../ptyprocess
+ rm -f dist/*
+ flit wheel
+ deactivate
+}
-if [ $ret -ne 0 ]; then
- # we always exit 0, preferring instead the jUnit XML
- # results to be the dominate cause of a failed build.
- echo "py.test returned exit code ${ret}." >&2
- echo "the build should detect and report these failing tests." >&2
-fi
+function prepare_environment() {
+ # create a virtualenv for target python version, install ptyprocess and test dependencies
+ rmvirtualenv ${venv} || true
+ mkvirtualenv -p `which python${pyversion}` ${venv} || true
+ workon ${venv}
+ pip uninstall --yes ptyprocess || true
+ pip install ../ptyprocess/dist/ptyprocess-*.whl
+ pip install --upgrade pytest-cov coverage coveralls pytest-capturelog
+}
+
+function do_test() {
+ # run tests
+ cd $here/..
+ ret=0
+ py.test \
+ --cov pexpect \
+ --cov-config .coveragerc \
+ --junit-xml=results.${osrel}.py${pyversion}.xml \
+ --verbose \
+ --verbose \
+ "$@" || ret=$?
+
+ if [ $ret -ne 0 ]; then
+ # we always exit 0, preferring instead the jUnit XML
+ # results to be the dominate cause of a failed build.
+ echo "py.test returned exit code ${ret}." >&2
+ echo "the build should detect and report these " \
+ "failing tests from the jUnit xml report." >&2
+ fi
+}
+
+function report_coverage() {
+ # combine all coverage to single file, report for this build,
+ # then move into ./build-output/ as a unique artifact to allow
+ # the final "Full build" step to combine and report to coveralls.io
+ `dirname $0`/teamcity-coverage-report.sh
+ mkdir -p build-output
+ mv .coverage build-output/.coverage.${osrel}.py{$pyversion}.$RANDOM.$$
+}
-# combine all coverage to single file, report for this build,
-# then move into ./build-output/ as a unique artifact to allow
-# the final "Full build" step to combine and report to coveralls.io
-`dirname $0`/teamcity-coverage-report.sh
-mkdir -p build-output
-mv .coverage build-output/.coverage.${osrel}.py{$pyversion}.$RANDOM.$$
+prepare_virtualenvwrapper
+make_wheel_for_ptyprocess
+prepare_environment
+do_test
+report_coverage