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

View File

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