diff --git a/.gitignore b/.gitignore index 8022a86b..a359b0bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,33 @@ -heat_specs.egg-info/ -doc/build/ -.tox/ *.pyc -.testrepository + +# Packages +*.egg* +*.egg-info +dist +build + +# Unit test / coverage reports +cover/ +.coverage* +!.coveragerc +.tox/ +.stestr/ +.venv + +# Mr Developer +.project +.pydevproject + +# Sphinx +doc/build/ + +# pbr generates these AUTHORS ChangeLog + +# Editors +*.swp +*~ + +# Files created by releasenotes build +releasenotes/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..c2c8a3a5 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./tests/ +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 1641f86e..00000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/.zuul.yaml b/.zuul.yaml index 59e88aac..5302f4b2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,6 +1,7 @@ - project: templates: - openstack-specs-jobs + - openstack-cover-jobs check: jobs: - openstack-tox-py38 diff --git a/test-requirements.txt b/test-requirements.txt index 5bd8d4bd..53255650 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,4 @@ -testrepository>=0.0.18 +coverage>=4.0 # Apache-2.0 +stestr>=2.0.0 # Apache-2.0 testtools>=0.9.34 testscenarios>=0.4 diff --git a/tox.ini b/tox.ini index 97853947..510bcca5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 1.6 +minversion = 3.18.0 envlist = docs,pep8 skipsdist = True @@ -10,14 +10,28 @@ setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -whitelist_externals = find +allowlist_externals = find commands = find . -type f -name "*.pyc" -delete - python setup.py testr --slowest --testr-args='{posargs}' + stestr run --slowest {posargs} [testenv:venv] commands = {posargs} +[testenv:cover] +basepython = python3 +allowlist_externals = find +setenv = + PYTHON=coverage run --source . --parallel-mode +commands = + coverage erase + find . -type f -name "*.pyc" -delete + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report + [testenv:docs] commands = sphinx-build -W -a -b html doc/source doc/build/html