Switch to stestr for unit tests

Moves coverage to a separate test environment and CI job.

Change-Id: I94697ba41afbae194136202dfab349eb0367a125
This commit is contained in:
Dmitry Tantsur 2018-09-10 12:51:52 +02:00
parent c7b36754be
commit d12d966218
6 changed files with 23 additions and 4 deletions

2
.gitignore vendored
View File

@ -24,7 +24,7 @@ develop-eggs
# Other
*.DS_Store
.idea
.testrepository
.stestr
.tox
.venv
.*.swp

2
.stestr.conf Normal file
View File

@ -0,0 +1,2 @@
[DEFAULT]
test_path=./metalsmith/test

View File

@ -172,6 +172,7 @@
- openstack-python35-jobs
- openstack-python36-jobs
- openstack-lower-constraints-jobs
- openstack-cover-jobs
- docs-on-readthedocs
vars:
rtd_webhook_id: '37378'

View File

@ -54,6 +54,7 @@ requestsexceptions==1.4.0
restructuredtext-lint==1.1.3
simplejson==3.15.0
six==1.10.0
stestr==1.0.0
stevedore==1.28.0
testtools==2.2.0
traceback2==1.4.0

View File

@ -7,5 +7,6 @@ flake8-import-order>=0.13 # LGPLv3
fixtures>=3.0.0 # Apache-2.0/BSD
hacking>=1.0.0 # Apache-2.0
mock>=2.0 # BSD
stestr>=1.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
Pygments>=2.2.0 # BSD

20
tox.ini
View File

@ -3,16 +3,30 @@ envlist = py3,py27,pep8
[testenv]
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
LANGUAGE=en_US
LC_ALL=en_US.UTF-8
PYTHONWARNINGS=default::DeprecationWarning
PYTHONDONTWRITEBYTECODE=1
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
coverage run --branch --include "metalsmith*" -m unittest discover metalsmith.test
coverage report -m --fail-under 90
setenv = PYTHONDONTWRITEBYTECODE=1
stestr run {posargs}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:cover]
basepython = python3
setenv = {[testenv]setenv}
PYTHON=coverage run --branch --source metalsmith --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage report -m --fail-under 90
coverage html -d ./cover --omit='*test*'
[testenv:venv]
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}