summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Goins <paul.goins@canonical.com>2019-03-01 11:51:43 +0100
committerPaul Goins <paul.goins@canonical.com>2019-03-01 14:40:18 +0100
commitb035ee30f19fdabc5bcbd9771eab1d99dde885a7 (patch)
tree8e3a3764b7ea5ede9053f0ed88ce631a199cd32e
parenta4b62a9a003d42eb0878fb96cface6d3534aa4ba (diff)
Added tox environment for gathering coverageHEADmaster
This technique was borrowed from the tox "cover" environment in openstack/nova's tox.ini. This leverages the fact that stestr lets you override the python executable via the PYTHON environment variable. Doing this allows us to easily generate coverage for our unit tests. An important caveat is that this does not provide any coverage for tests via zaza, amulet, etc. It is purely focused on the unit tests. Note that this replaces the previous .coveragerc; coverage configuration is instead pulled from tox.ini. Change-Id: Ia0f190f7de273290d01091fd9211a4bbdb688be5
Notes
Notes (review): Verified+1: Canonical CI <uosci-testing-bot@ubuntu.com> Code-Review+2: James Page <james.page@canonical.com> Workflow+1: James Page <james.page@canonical.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 04 Mar 2019 10:20:01 +0000 Reviewed-on: https://review.openstack.org/640321 Project: openstack/charm-interface-hacluster Branch: refs/heads/master
-rw-r--r--.zuul.yaml1
-rw-r--r--tox.ini27
2 files changed, 28 insertions, 0 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index 7051aee..dc27661 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,3 +1,4 @@
1- project: 1- project:
2 templates: 2 templates:
3 - python35-charm-jobs 3 - python35-charm-jobs
4 - openstack-cover-jobs
diff --git a/tox.ini b/tox.ini
index 90a8a09..e5ceb65 100644
--- a/tox.ini
+++ b/tox.ini
@@ -30,6 +30,33 @@ basepython = python3
30deps = -r{toxinidir}/test-requirements.txt 30deps = -r{toxinidir}/test-requirements.txt
31commands = flake8 {posargs} 31commands = flake8 {posargs}
32 32
33[testenv:cover]
34# Technique based heavily upon
35# https://github.com/openstack/nova/blob/master/tox.ini
36basepython = python3
37deps = -r{toxinidir}/test-requirements.txt
38setenv =
39 {[testenv]setenv}
40 PYTHON=coverage run
41commands =
42 coverage erase
43 ostestr {posargs}
44 coverage combine
45 coverage html -d cover
46 coverage xml -o cover/coverage.xml
47 coverage report
48
49[coverage:run]
50branch = True
51concurrency = multiprocessing
52parallel = True
53source =
54 .
55omit =
56 .tox/*
57 */charmhelpers/*
58 unit_tests/*
59
33[testenv:venv] 60[testenv:venv]
34basepython = python3 61basepython = python3
35commands = {posargs} 62commands = {posargs}