From 606fe59d64a76d5548739dddbd5a00e0264ea996 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 --- .stestr.conf | 3 +++ test-requirements.txt | 8 ++++---- tox.ini | 24 +++++++++--------------- 3 files changed, 16 insertions(+), 19 deletions(-) create mode 100644 .stestr.conf diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..ea359ca --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./tests +top_dir=./ 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..8343343 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 +minversion = 4.4 +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