summaryrefslogtreecommitdiffstats
path: root/clamp-policy
diff options
context:
space:
mode:
authorMiroslav Los <miroslav.los@pantheon.tech>2019-12-18 13:29:54 +0100
committerMiroslav Los <miroslav.los@pantheon.tech>2019-12-18 14:40:05 +0100
commitf31bd85266b8bdb7d95bb6f6e2f6d48967278f9a (patch)
treed53671ae3e4bf8a5f2365b079723f2950cfaec33 /clamp-policy
parent4435e8803a6844245d2529cae840a3d55d84c296 (diff)
Fix tox configuration for coverage
Coverage is unable to report on modules unless PYTHONPATH is set. Put test results into separate files for python 2 and 3. Merge coverage of python 2 and 3 in a final report. Silence warnings on xunit2 pytest output format. Signed-off-by: Miroslav Los <miroslav.los@pantheon.tech> Issue-ID: DCAEGEN2-2005 Change-Id: I2740231274c153d178e7d9c9103fc70657f7558d
Diffstat (limited to 'clamp-policy')
-rw-r--r--clamp-policy/tox-local.ini25
-rw-r--r--clamp-policy/tox.ini22
2 files changed, 40 insertions, 7 deletions
diff --git a/clamp-policy/tox-local.ini b/clamp-policy/tox-local.ini
index e41b3f4..314229c 100644
--- a/clamp-policy/tox-local.ini
+++ b/clamp-policy/tox-local.ini
@@ -1,13 +1,30 @@
-# tox -c tox-local.ini | tee -a logs/test_clamppolicyplugin.log 2>&1
+# tox -c tox-local.ini
[tox]
-envlist = py27,py36
+envlist = py27,py36,cov
[testenv]
+# coverage can only find modules if pythonpath is set
+setenv=
+ PYTHONPATH={toxinidir}
+ COVERAGE_FILE=.coverage.{envname}
deps=
-rrequirements.txt
pytest
coverage
pytest-cov
-# recreate = True
commands=
- pytest -v --cov clamppolicyplugin --cov-report html
+ coverage erase
+ pytest --junitxml xunit-results.{envname}.xml --cov clamppolicyplugin
+
+[testenv:cov]
+skip_install = true
+deps=
+ coverage
+setenv=
+ COVERAGE_FILE=.coverage
+commands=
+ coverage combine
+ coverage html
+
+[pytest]
+junit_family = xunit2
diff --git a/clamp-policy/tox.ini b/clamp-policy/tox.ini
index 9e09c4a..21ecdb2 100644
--- a/clamp-policy/tox.ini
+++ b/clamp-policy/tox.ini
@@ -1,13 +1,29 @@
-# content of: tox.ini , put in same dir as setup.py
[tox]
-envlist = py27,py36
+envlist = py27,py36,cov
[testenv]
+# coverage can only find modules if pythonpath is set
+setenv=
+ PYTHONPATH={toxinidir}
+ COVERAGE_FILE=.coverage.{envname}
deps=
-rrequirements.txt
pytest
coverage
pytest-cov
commands=
- pytest --junitxml xunit-results.xml --cov clamppolicyplugin --cov-report xml
+ coverage erase
+ pytest --junitxml xunit-results.{envname}.xml --cov clamppolicyplugin
+
+[testenv:cov]
+skip_install = true
+deps=
+ coverage
+setenv=
+ COVERAGE_FILE=.coverage
+commands=
+ coverage combine
coverage xml
+
+[pytest]
+junit_family = xunit2