From e11be5dc15e6800ed6111b7773b9e44571343207 Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Thu, 21 Sep 2017 12:19:32 -0400 Subject: Fix tox to give more accurate coverage reports * Also attempted to get sonar working * Fixed minor things along the way Change-Id: I434c0d791140e75cd5997be0cc3fefce7ccc292f Issue-Id: DCAEGEN2-60 Signed-off-by: Michael Hwang --- python-dockering/.coveragerc | 21 +++++++++++++++++++++ python-dockering/dockering/core.py | 2 +- python-dockering/pom.xml | 18 ++++++------------ python-dockering/tox.ini | 3 +-- 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 python-dockering/.coveragerc (limited to 'python-dockering') diff --git a/python-dockering/.coveragerc b/python-dockering/.coveragerc new file mode 100644 index 0000000..088c2da --- /dev/null +++ b/python-dockering/.coveragerc @@ -0,0 +1,21 @@ +# .coveragerc to control coverage.py +[run] +branch = True + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if self\.debug + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: diff --git a/python-dockering/dockering/core.py b/python-dockering/dockering/core.py index 9ef1ae3..d82e346 100644 --- a/python-dockering/dockering/core.py +++ b/python-dockering/dockering/core.py @@ -104,7 +104,7 @@ def start_container(client, container): # TODO: Have logic to inspect response and through NonRecoverableError # when start fails. Docker-py docs don't quickly tell me what the # response looks like. - response = client.start(container=container["Id"]) + client.start(container=container["Id"]) utils.logger.info("Container started: {0}".format(container["Id"])) # TODO: Maybe check stats? diff --git a/python-dockering/pom.xml b/python-dockering/pom.xml index afc39a8..0933bcb 100644 --- a/python-dockering/pom.xml +++ b/python-dockering/pom.xml @@ -26,27 +26,21 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. 1.0.0-SNAPSHOT org.onap.dcaegen2.utils - onap-dcae-dockering + python-dockering dcaegen2-utils-python-dockering 1.0.0-SNAPSHOT http://maven.apache.org UTF-8 - true - - - - + + . + xunit-results.xml + coverage.xml py Python **/*.py - - + tests/* ${project.artifactId}-${project.version} diff --git a/python-dockering/tox.ini b/python-dockering/tox.ini index 987b009..280cf78 100644 --- a/python-dockering/tox.ini +++ b/python-dockering/tox.ini @@ -4,8 +4,7 @@ envlist = py27,py35 [testenv] deps= - -rrequirements.txt pytest coverage pytest-cov -commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir} --cov-report=xml +commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/dockering --cov-report=xml -- cgit 1.2.3-korg