diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..2615cc2d9 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = True +source = kayobe + +[report] +ignore_errors = True diff --git a/.gitignore b/.gitignore index e79f26ab4..fc4531c4c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ cover/ .coverage* !.coveragerc .tox +nosetests.xml +.testrepository +.stestr .venv # Mr Developer diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 000000000..bb02a4f05 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=${TESTS_DIR:-./kayobe/tests/unit/} +top_dir=./ diff --git a/test-requirements.txt b/test-requirements.txt index 56b561557..f71fae41c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,3 +11,4 @@ hacking>=0.12.0,<0.13 # Apache-2.0 molecule<3 # MIT oslotest>=1.10.0 # Apache-2.0 sphinx>=1.5.1 # BSD +stestr # Apache-2.0 diff --git a/tox.ini b/tox.ini index 342b202d2..b77603a70 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = py34,py27,pypy,pep8 +envlist = py35,py27,pep8 skipsdist = True [testenv] @@ -13,9 +13,11 @@ whitelist_externals = setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning - TESTS_DIR=./kayobe/tests/unit/ + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_TEST_TIMEOUT=60 deps = -r{toxinidir}/test-requirements.txt -commands = unit2 discover {posargs} +commands = stestr run {posargs} [testenv:pep8] commands = @@ -80,6 +82,18 @@ commands = -not -name idrac-bootstrap.yml) \ {posargs}" +[testenv:cover] +setenv = + VIRTUAL_ENV={envdir} + PYTHON=coverage run --source kayobe --parallel-mode +commands = + coverage erase + stestr run {posargs} + coverage combine + coverage report + coverage html -d cover + coverage xml -o cover/coverage.xml + [flake8] # E123, E125 skipped as they are invalid PEP-8. diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 905258dba..30f39b981 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -5,6 +5,7 @@ - openstack-tox-pep8 - openstack-tox-py27 - openstack-tox-py35 + - openstack-tox-cover - build-openstack-sphinx-docs - kayobe-tox-ansible-syntax - kayobe-tox-ansible @@ -15,6 +16,7 @@ - openstack-tox-pep8 - openstack-tox-py27 - openstack-tox-py35 + - openstack-tox-cover - build-openstack-sphinx-docs - kayobe-tox-ansible-syntax - kayobe-tox-ansible