From 492c33675f62dc34703c7486b15a2da2d062de9c Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 10 Feb 2021 14:59:54 +0000 Subject: [PATCH] Migrate from testr to stestr Signed-off-by: Stephen Finucane Change-Id: I0f4a000ee4c0d54d1f1b016380ef0ca68f050854 --- .gitignore | 28 ++---------------------- .stestr.conf | 3 +++ .testr.conf | 7 ------ test-requirements.txt | 7 +----- tox.ini | 50 +++++++++++++++++++++++++++---------------- 5 files changed, 37 insertions(+), 58 deletions(-) create mode 100644 .stestr.conf delete mode 100644 .testr.conf diff --git a/.gitignore b/.gitignore index 963e589..59acfbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ *.py[cod] -# C extensions -*.so - # Packages *.egg* *.egg-info @@ -18,30 +15,14 @@ develop-eggs lib lib64 -# Installer logs -pip-log.txt - # Unit test / coverage reports cover/ .coverage* !.coveragerc .tox -nosetests.xml -.testrepository +.stestr .venv -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# Complexity -output/*.html -output/*/index.html - # Sphinx doc/build @@ -49,10 +30,5 @@ doc/build AUTHORS ChangeLog -# Editors -*~ -.*.swp -.*sw? - # Files created by releasenotes build -releasenotes/build \ No newline at end of file +releasenotes/build diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..ac0bd9e --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./whereto/tests +top_dir=./ diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 6d83b3c..0000000 --- a/.testr.conf +++ /dev/null @@ -1,7 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${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/test-requirements.txt b/test-requirements.txt index 540b720..e1c486c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,10 +1,5 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - hacking>=3.0.1,<3.1.0 # Apache-2.0 - coverage>=4.0,!=4.4 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT +stestr>=2.0.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index f0f7f84..1849abe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,30 +1,32 @@ [tox] minversion = 3.1.1 envlist = py38,pep8 -skipsdist = True -ignore_basepython_conflict = True +skipsdist = true +ignore_basepython_conflict = true [testenv] basepython = python3 -usedevelop = True +usedevelop = true setenv = - VIRTUAL_ENV={envdir} - PYTHONWARNINGS=default::DeprecationWarning + LANGUAGE=en_US + LC_ALL=en_US.utf-8 + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_TEST_TIMEOUT=60 + PYTHONDONTWRITEBYTECODE=1 + PYTHONWARNINGS=default::DeprecationWarning deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt + -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/test-requirements.txt + -r{toxinidir}/requirements.txt commands = - python setup.py test --coverage --coverage-package-name=whereto --slowest --testr-args='{posargs}' - coverage report --show-missing + stestr run {posargs} + stestr slowest [testenv:pep8] commands = flake8 {posargs} [testenv:venv] -# The sphinxcontrib.autoprogram extension requires python 3's version -# of argparse, so force python 3 here to ensure the check job that -# builds the docs on OpenStack infrastructure uses python 3. commands = {posargs} [testenv:bindep] @@ -32,25 +34,35 @@ deps = bindep commands = bindep test [testenv:cover] -commands = python setup.py test --coverage --testr-args='{posargs}' +setenv = + {[testenv]setenv} + PYTHON=coverage run --source nova --parallel-mode +commands = + coverage erase + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report [testenv:docs] -deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} - -r{toxinidir}/doc/requirements.txt +deps = + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -r{toxinidir}/doc/requirements.txt commands = - sphinx-build --keep-going -b html -W doc/source doc/build/html + sphinx-build -a -E -W --keep-going -b html doc/source doc/build/html [testenv:releasenotes] +envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} commands = - sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html + sphinx-build -a -E -W --keep-going -b html releasenotes/source releasenotes/build/html [testenv:debug] commands = oslo_debug_helper {posargs} [flake8] # E123, E125 skipped as they are invalid PEP-8. - show-source = True ignore = E123,E125 builtins = _