Browse Source

Use ostestr unit test runner

This patch moves ironic-inspector to use 'stestr' test runner
via 'ostestr' wrapper.

Effective changes:

- unit tests are now being run in parallel by default
- 'py*' jobs are not running code coverage measurements,
  which is left for 'cover' job only
- 'cover' job now also produces html reports consumable by upstream CI,
  and fails under 90% of code coverage
- users can leverage all the ostestr/stestr features

Change-Id: I75f539457dbb1d811fdee69de52d1bcee4c6ebe6
Depends-On: Ica838db23b5714c2da1e4313e1a7ece0ca241d44
Closes-Bug: #1666232
changes/22/508122/3
Pavlo Shchelokovskyy 4 years ago
committed by Milan Kováčik
parent
commit
7625ed68c8
  1. 3
      .gitignore
  2. 3
      .stestr.conf
  3. 1
      test-requirements.txt
  4. 20
      tox.ini

3
.gitignore

@ -27,6 +27,7 @@ develop-eggs
# Other
*.DS_Store
.idea
.stestr
.testrepository
.tox
.venv
@ -39,4 +40,4 @@ ChangeLog
*~
# Vagrant
.vagrant
.vagrant

3
.stestr.conf

@ -0,0 +1,3 @@
[DEFAULT]
test_path=${TESTS_DIR:-./ironic_inspector/test/unit/}
top_dir=./

1
test-requirements.txt

@ -8,6 +8,7 @@ hacking<0.13,>=0.12.0 # Apache-2.0
mock>=2.0.0 # BSD
sphinx>=1.6.2 # BSD
openstackdocstheme>=1.17.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
testresources>=2.0.0 # Apache-2.0/BSD

20
tox.ini

@ -8,10 +8,12 @@ deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/plugin-requirements.txt
commands =
coverage run --branch --include "ironic_inspector*" -m unittest discover ironic_inspector.test.unit
coverage report -m --fail-under 90
setenv = PYTHONDONTWRITEBYTECODE=1
TZ=UTC
ostestr {posargs}
setenv =
VIRTUAL_ENV={envdir}
PYTHONDONTWRITEBYTECODE=1
TZ=UTC
TESTS_DIR=./ironic_inspector/test/unit/
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:venv]
@ -22,9 +24,15 @@ envdir = {toxworkdir}/venv
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --branch --omit='*test*' --source ironic_inspector --parallel-mode
commands =
coverage run --branch --include "ironic_inspector*" -m unittest discover ironic_inspector.test.unit
coverage report -m
coverage erase
ostestr {posargs}
coverage combine
coverage report -m --omit='*test*' --fail-under 90
coverage html -d ./cover --omit='*test*'
[testenv:pep8]
basepython = python2.7

Loading…
Cancel
Save