Merge "Migrate to stestr as unit tests runner"

This commit is contained in:
Zuul 2019-03-22 07:31:06 +00:00 committed by Gerrit Code Review
commit 9bbef34bd9
5 changed files with 24 additions and 16 deletions

1
.gitignore vendored
View File

@ -32,6 +32,7 @@ subunit.log
!/.pylintrc
!/.testr.conf
!/.zuul.yaml
!/.stestr.conf
# Files created by releasenotes build
releasenotes/build

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./neutron_fwaas/tests/unit}
top_dir=./

View File

@ -12,11 +12,11 @@ venv=${1:-"dsvm-functional"}
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u $owner chmod o+rw .
sudo -H -u $owner chmod o+rw -R .testrepository
if [ -f ".testrepository/0" ] ; then
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
sudo -H -u $owner chmod o+rw -R .stestr
if [ -f ".stestr/0" ] ; then
.tox/$venv/bin/subunit-1to2 < .stestr/0 > ./stestr.subunit
$SCRIPTS_DIR/subunit2html ./stestr.subunit testr_results.html
gzip -9 ./stestr.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi

View File

@ -10,7 +10,7 @@ python-subunit>=1.0.0 # Apache-2.0/BSD
requests-mock>=1.2.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
stestr>=1.0.0 # Apache-2.0
testresources>=2.0.0 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
testscenarios>=0.4 # Apache-2.0/BSD

24
tox.ini
View File

@ -16,10 +16,7 @@ whitelist_externals =
commands =
find . -type f -name "*.py[c|o]" -delete
find . -path "*/__pycache__*" -delete
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
# there is also secret magic in ostestr which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
stestr run {posargs}
[testenv:common]
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
@ -43,7 +40,7 @@ setenv = {[testenv]setenv}
OS_TEST_PATH=./neutron_fwaas/tests/functional
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
commands =
python setup.py testr --slowest --testr-args='{posargs}'
stestr run {posargs}
[testenv:dsvm-fullstack]
basepython = python3
@ -63,7 +60,7 @@ setenv =
OS_TESTR_CONCURRENCY=1
TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc}
commands =
python setup.py testr --slowest --testr-args='{posargs}'
stestr run {posargs}
[testenv:scenario]
basepython = python3
@ -73,7 +70,7 @@ setenv =
OS_TESTR_CONCURRENCY=1
TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:/opt/stack/tempest/etc}
commands =
python setup.py testr --slowest --testr-args='{posargs}'
stestr run {posargs}
[testenv:dsvm-functional]
setenv =
@ -89,7 +86,7 @@ whitelist_externals =
sudo
commands =
{toxinidir}/tools/deploy_rootwrap.sh {toxinidir} {envdir}/etc {envdir}/bin
python setup.py testr --slowest --testr-args='{posargs}'
stestr run {posargs}
[testenv:releasenotes]
basepython = python3
@ -109,9 +106,16 @@ whitelist_externals = sh
[testenv:cover]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
LANGUAGE=en_US
PYTHON=coverage run --source neutron_fwaas --omit='*tests*' --parallel-mode
commands =
python setup.py test --coverage --coverage-package-name=neutron_fwaas --testr-args='{posargs}'
coverage report
coverage erase
stestr run {posargs}
coverage combine
coverage report --skip-covered --omit='*test*'
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:venv]
basepython = python3