diff --git a/.gitignore b/.gitignore index a6f182eb4..3a53f0494 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ subunit.log !/.pylintrc !/.testr.conf !/.zuul.yaml +!/.stestr.conf # Files created by releasenotes build releasenotes/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..bd1baede4 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./neutron_fwaas/tests/unit} +top_dir=./ diff --git a/neutron_fwaas/tests/contrib/post_test_hook.sh b/neutron_fwaas/tests/contrib/post_test_hook.sh index bc7c76722..352618718 100644 --- a/neutron_fwaas/tests/contrib/post_test_hook.sh +++ b/neutron_fwaas/tests/contrib/post_test_hook.sh @@ -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 diff --git a/test-requirements.txt b/test-requirements.txt index 82670ae2d..926bcb3c2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 diff --git a/tox.ini b/tox.ini index d36556744..cbf397a62 100644 --- a/tox.ini +++ b/tox.ini @@ -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