diff --git a/run-tests.sh b/setup-test-env.sh similarity index 83% rename from run-tests.sh rename to setup-test-env.sh index 095064c07..bb8f0ca15 100755 --- a/run-tests.sh +++ b/setup-test-env.sh @@ -8,12 +8,7 @@ function clean_exit(){ return $error_code } -if [ "$1" = "--coverage" ]; then - COVERAGE_ARG="$1" - shift -fi - -# Main unit tests +# Setup MongoDB test server MONGO_DATA=`mktemp -d /tmp/CEILO-MONGODB-XXXXX` MONGO_PORT=29000 trap "clean_exit" EXIT @@ -31,7 +26,8 @@ do echo "$line" | grep -q "waiting for connections on port ${MONGO_PORT}" && break done < ${MONGO_DATA}/out # Read the fifo for ever otherwise mongod would block -# + that gives us the log on screen cat ${MONGO_DATA}/out > /dev/null & export CEILOMETER_TEST_MONGODB_URL="mongodb://localhost:${MONGO_PORT}/ceilometer" -python setup.py testr --slowest --testr-args="$*" $COVERAGE_ARG + +# Yield execution to venv command +$* diff --git a/tox.ini b/tox.ini index 40c44c184..331672b56 100644 --- a/tox.ini +++ b/tox.ini @@ -14,13 +14,13 @@ setenv = VIRTUAL_ENV={envdir} LC_ALL=C EVENTLET_NO_GREENDNS=yes commands = - bash -x {toxinidir}/run-tests.sh {posargs} + bash -x {toxinidir}/setup-test-env.sh python setup.py testr --slowest --testr-args="{posargs}" {toxinidir}/tools/config/check_uptodate.sh downloadcache = {toxworkdir}/_download [testenv:cover] setenv = VIRTUAL_ENV={envdir} -commands = bash -x {toxinidir}/run-tests.sh --coverage +commands = bash -x {toxinidir}/setup-test-env.sh python setup.py testr --slowest --coverage --testr-args="{posargs}" [testenv:pep8] # Install bounded pep8/pyflakes first, then let flake8 install @@ -40,7 +40,7 @@ commands = python setup.py build_sphinx [testenv:venv] deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = {posargs} +commands = bash -x {toxinidir}/setup-test-env.sh {posargs} [flake8] ignore = None