Improve tests

Upgrade tox version
Add basic venv environment for tox
Upgrade hacking and pycodestyle versions
Add coverage tests
Move to yoga openstack tests

Change-Id: Ic452ed0ae4075f4b9ece1e49b163b8da5343910e
This commit is contained in:
Riccardo Pittau 2021-10-18 10:07:33 +02:00
parent e00036252b
commit 2064aa2f4f
2 changed files with 37 additions and 26 deletions

58
tox.ini
View File

@ -1,51 +1,61 @@
[tox]
minversion = 3.9.0
minversion = 3.18.0
envlist = py3,pep8
skipsdist = True
ignore_basepython_conflict=true
[testenv]
basepython = python3
setenv = VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
TESTS_DIR=./pyghmi/tests/unit/
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
setenv =
VIRTUAL_ENV={envdir}
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_ALL=C
TESTS_DIR=./pyghmi/tests/unit/
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands = stestr run --slowest {posargs}
[testenv:pep8]
deps =
hacking>=3.1.0,<4.0.0 # Apache-2.0
deps=
hacking>=4.1.0,<5.0.0 # Apache-2.0
flake8-import-order>=0.17.1 # LGPLv3
pycodestyle>=2.0.0,<2.7.0 # MIT
pycodestyle>=2.0.0,<3.0.0 # MIT
whitelist_externals = bash
commands = flake8
[testenv:venv]
setenv = PYTHONHASHSEED=0
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source pyghmi --parallel-mode
commands =
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
{[testenv]setenv}
PYTHON=coverage run --parallel-mode
commands = coverage erase
stestr run {posargs}
coverage combine
coverage report
coverage html
coverage xml -o cover/coverage.xml
[testenv:docs]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
-c{env:TOX_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
[testenv:venv]
commands = {posargs}
[flake8]
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
show-source = true

View File

@ -7,8 +7,9 @@
- project:
templates:
- check-requirements
- openstack-python3-xena-jobs
- build-openstack-docs-pti
- openstack-cover-jobs
- openstack-python3-yoga-jobs
- publish-openstack-docs-pti
check:
jobs:
- virtualbmc-tempest-ironic-ipmi-iscsi-pyghmi-src: