From e3926569460e5096a47525d4049ffb47799563fa Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 5 Sep 2023 11:25:46 +0100 Subject: [PATCH] tests: Migrate to pytest nose is not compatible with Python 3.10 or later and stestr can't handle multiple test directories nor test directories that are not importable modules. While here, we also fix the case for two other dependencies to prevent test failures. We also update the tox file to reflect modern best practices. Change-Id: Ie7b57b1f34957459793bcaa5253ce1b446e36336 Signed-off-by: Stephen Finucane --- test-requirements.txt | 8 ++++---- tox.ini | 22 ++++++++-------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index e0b5dbc..cc29ece 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ transaction pecan sphinx>=3.0.0 # BSD Flask -flask-restful -nose -coverage!=4.4,>=4.0 # Apache-2.0 -webtest +Flask-RESTful # BSD +pytest # MIT +pytest-cov # MIT +WebTest # MIT diff --git a/tox.ini b/tox.ini index 03023cc..ae41591 100644 --- a/tox.ini +++ b/tox.ini @@ -1,29 +1,23 @@ [tox] minversion = 3.1 -envlist = py36,py37,py38,py39,pypy,coverage,pep8 -ignore_basepython_conflict = true +envlist = py3,coverage,pep8 [testenv] -basepython = python3 -setenv = - COVERAGE_FILE=.coverage.{envname} deps = -r test-requirements.txt commands = - {envbindir}/coverage run {envbindir}/nosetests --nologcapture --with-xunit --xunit-file nosetests-{envname}.xml wsme/tests tests/pecantest tests/test_sphinxext.py tests/test_flask.py --verbose {posargs} - {envbindir}/coverage report --show-missing --include="wsme/*.py","wsme/rest/*.py","wsmeext/*.py" --omit "wsme/tests/*" + pytest wsme/tests tests/pecantest tests/test_sphinxext.py tests/test_flask.py [testenv:coverage] -setenv = - COVERAGE_FILE=.coverage commands = - {envbindir}/coverage erase - {envbindir}/coverage combine - {envbindir}/coverage xml --include="wsme/*.py","wsme/rest/*.py","wsmeext/*.py" --omit "wsme/tests/*" - {envbindir}/coverage report --show-missing --include="wsme/*.py","wsme/rest/*.py","wsmeext/*.py" --omit "wsme/tests/*" + coverage erase + pytest --cov=wsme --cov=wsme_ext wsme/tests tests/pecantest tests/test_sphinxext.py tests/test_flask.py + coverage combine + coverage xml --include="wsme/*.py","wsme/rest/*.py","wsmeext/*.py" --omit "wsme/tests/*" + coverage report --show-missing --include="wsme/*.py","wsme/rest/*.py","wsmeext/*.py" --omit "wsme/tests/*" [testenv:docs] -whitelist_externals = +allowlist_externals = rm deps = -r doc/requirements.txt