Manage constraints with testenv install_command

This prevents having to duplicate the -c{} deps argument
across all environments in tox.ini

In addition this switches to stestr instead of testing
through setup.py

Change-Id: I3d0b6ca81be88660dcbbbeed0c3705771b258cb2
changes/78/799178/2
Dantali0n 2021-07-02 10:55:58 +02:00
parent f66397a3cc
commit f50fe604ac
4 changed files with 26 additions and 17 deletions

1
.gitignore vendored
View File

@ -38,6 +38,7 @@ cover/
.coverage*
!.coveragerc
.tox
.stestr
nosetests.xml
.testrepository
.venv

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./watcher_tempest_plugin}
top_dir=./

View File

@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.
hacking>=3.2.,<3.3 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD

37
tox.ini
View File

@ -7,14 +7,13 @@ ignore_basepython_conflict = True
[testenv]
basepython = python3
usedevelop = True
install_command = pip install {opts} {packages}
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
commands = stestr run --slowest {posargs}
[testenv:pep8]
commands =
@ -22,15 +21,21 @@ commands =
flake8
bandit -r watcher_tempest_plugin -x tests -n5 -ll -s B320
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source ironic_tempest_plugin --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:docs]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
@ -53,6 +58,15 @@ commands =
[testenv:debug]
commands = oslo_debug_helper {posargs}
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r watcher_tempest_plugin -x tests -n5 -ll -s B320
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[flake8]
show-source=True
ignore= H105,E123,E226,N320,H202,W503
@ -62,12 +76,3 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,demo/,releasenotes
[doc8]
extension=.rst
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r watcher_tempest_plugin -x tests -n5 -ll -s B320
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build