diff --git a/.gitignore b/.gitignore index 75c7ab3d..bf27aa52 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ nosetests.xml .testrepository .venv .log - +!.stestr.conf # Translations *.mo diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..13130736 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${OS_TEST_PATH:-./karbor/tests/unit} +top_dir=./ diff --git a/karbor/tests/contrib/post_test_hook.sh b/karbor/tests/contrib/post_test_hook.sh index f672023b..3de780ba 100644 --- a/karbor/tests/contrib/post_test_hook.sh +++ b/karbor/tests/contrib/post_test_hook.sh @@ -23,11 +23,11 @@ function generate_test_logs { 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/lower-constraints.txt b/lower-constraints.txt index 9b7250fb..3113ba28 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -133,11 +133,11 @@ sqlalchemy-migrate==0.11.0 SQLAlchemy==1.0.10 sqlparse==0.2.4 statsd==3.2.2 +stestr==2.0.0 stevedore==1.20.0 taskflow==2.16.0 Tempita==0.5.2 tenacity==4.9.0 -testrepository==0.0.20 testresources==2.0.1 testscenarios==0.4 testtools==2.2.0 diff --git a/playbooks/legacy/karbor-dsvm-fullstack/post.yaml b/playbooks/legacy/karbor-dsvm-fullstack/post.yaml index dac87534..5f4a3293 100644 --- a/playbooks/legacy/karbor-dsvm-fullstack/post.yaml +++ b/playbooks/legacy/karbor-dsvm-fullstack/post.yaml @@ -35,7 +35,7 @@ copy_links: true verify_host: true rsync_opts: - - --include=/.testrepository/tmp* + - --include=/.stestr/tmp* - --include=*/ - --exclude=* - --prune-empty-dirs @@ -48,7 +48,7 @@ copy_links: true verify_host: true rsync_opts: - - --include=**/*testrepository.subunit.gz + - --include=**/*stestr.subunit.gz - --include=*/ - --exclude=* - --prune-empty-dirs diff --git a/test-requirements.txt b/test-requirements.txt index 47ef3a4e..86e9df0f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,6 +9,7 @@ croniter>=0.3.4 # MIT License python-subunit>=1.0.0 # Apache-2.0/BSD sphinx!=1.6.6,>=1.6.2 # BSD oslotest>=3.2.0 # Apache-2.0 +stestr>=2.0.0 # Apache-2.0 taskflow>=2.16.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT diff --git a/tox.ini b/tox.ini index 43e2bb3f..e8e30d75 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 1.6 +minversion = 2.0 envlist = py35,py27,pypy,pep8 skipsdist = True @@ -13,10 +13,11 @@ setenv = LANGUAGE=en_US LC_ALL=en_US.utf-8 deps = -r{toxinidir}/test-requirements.txt -whitelist_externals = rm +whitelist_externals = sh /bin/rm commands = - rm -f .testrepository/times.dbm - python setup.py test --slowest --testr-args='{posargs}' + /bin/rm -f .testrepository/times.dbm + stestr run {posargs} + stestr slowest [testenv:fullstack] basepython = python2.7 @@ -24,7 +25,8 @@ setenv = OS_TEST_PATH=./karbor/tests/fullstack OS_TEST_TIMEOUT=3600 commands = oslo-config-generator --config-file etc/oslo-config-generator/karbor.conf --output-file etc/karbor.conf - python setup.py test --slowest --testr-args="--concurrency=4 {posargs}" + stestr --test-path=./karbor/tests/fullstack run '--concurrency=4 {posargs}' + stestr slowest [testenv:pep8] basepython = python3 @@ -36,15 +38,21 @@ commands = {posargs} [testenv:cover] basepython = python3 +setenv = + {[testenv]setenv} + PYTHON=coverage run --source karbor --parallel-mode commands = - python setup.py test --coverage --testr-args='{posargs}' + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml coverage report [testenv:docs] basepython = python3 -whitelist_externals = rm -commands = rm -rf doc/build - rm -rf doc/source/contributor/api +whitelist_externals = sh /bin/rm +commands = /bin/rm -rf doc/build + /bin/rm -rf doc/source/contributor/api python setup.py build_sphinx [testenv:debug] @@ -55,10 +63,10 @@ commands = oslo_debug_helper -t karbor/tests/unit {posargs} basepython = python3 # This environment is called from CI scripts to test and publish # the API Ref to developer.openstack.org. -whitelist_externals = rm +whitelist_externals = sh /bin/rm deps = -r{toxinidir}/test-requirements.txt commands = - rm -rf api-ref/build + /bin/rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/ [testenv:releasenotes]