diff --git a/.gitignore b/.gitignore index 3e20723ad..abdf7b022 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,6 @@ run_tests.err.log run_tests.log .autogenerated .coverage -.testrepository/ +.stestr/ .tox/ .venv/ diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..6a6b6f120 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./neutronclient/tests/unit +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 01dee7036..000000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./neutronclient/tests/unit} $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/lower-constraints.txt b/lower-constraints.txt index 2bf9a3198..117d04b2e 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -105,11 +105,10 @@ snowballstemmer==1.2.1 Sphinx==1.6.2 sphinxcontrib-websupport==1.0.1 statsd==3.2.1 -stestr==1.0.0 +stestr==2.0.0 stevedore==1.20.0 tempest==17.1.0 tenacity==3.2.1 -testrepository==0.0.18 testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 diff --git a/neutronclient/tests/functional/hooks/post_test_hook.sh b/neutronclient/tests/functional/hooks/post_test_hook.sh index 43cc9c4b7..d62d13911 100755 --- a/neutronclient/tests/functional/hooks/post_test_hook.sh +++ b/neutronclient/tests/functional/hooks/post_test_hook.sh @@ -32,11 +32,11 @@ function generate_test_logs { function generate_testr_results { # Give job user rights to access tox logs sudo -H -u $USER chmod o+rw . - sudo -H -u $USER 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 $USER 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 77a33e6ca..11865b828 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,7 +13,7 @@ osprofiler>=2.3.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD requests-mock>=1.2.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD +stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD tempest>=17.1.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index e40ac3e67..76c62a262 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/re commands = sh -c "find . -type d -name '.?*' -prune -o \ \( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \ -print0 | xargs -0 rm -rf" - python setup.py testr --testr-args='{posargs}' + stestr run {posargs} whitelist_externals = sh [testenv:pep8] @@ -47,9 +47,15 @@ setenv = [testenv:cover] basepython = python3 +setenv = + {[testenv]setenv} + PYTHON=coverage run --source neutronclient --parallel-mode commands = - python setup.py test --coverage --coverage-package-name=neutronclient --testr-args='{posargs}' - coverage report + stestr run '{posargs}' + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] basepython = python3