Refactored run-tests script

Refactored run-tests script to become a setup script.
This is needed to make it work correctly with arbitary command we want
to run in venv (testenv:venv in tox).

Change-Id: I91d0e7a05fb1b9fa13e18789281fdf5267f5b526
This commit is contained in:
Alexei Kornienko 2014-02-09 16:36:07 +02:00 committed by Alexei Kornienko
parent 25113a37a7
commit e626c9ca28
2 changed files with 7 additions and 11 deletions

View File

@ -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
$*

View File

@ -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