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 <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2023-09-05 11:25:46 +01:00
parent a45e0af97e
commit e392656946
2 changed files with 12 additions and 18 deletions

View File

@ -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

22
tox.ini
View File

@ -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