summaryrefslogtreecommitdiffstats
path: root/python-discovery-client
diff options
context:
space:
mode:
Diffstat (limited to 'python-discovery-client')
-rw-r--r--python-discovery-client/.coveragerc21
-rw-r--r--python-discovery-client/discovery_client/discovery.py4
-rw-r--r--python-discovery-client/pom.xml16
-rw-r--r--python-discovery-client/tests/test_discovery.py6
-rw-r--r--python-discovery-client/tox.ini3
5 files changed, 31 insertions, 19 deletions
diff --git a/python-discovery-client/.coveragerc b/python-discovery-client/.coveragerc
new file mode 100644
index 0000000..088c2da
--- /dev/null
+++ b/python-discovery-client/.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-discovery-client/discovery_client/discovery.py b/python-discovery-client/discovery_client/discovery.py
index 180e933..51b5897 100644
--- a/python-discovery-client/discovery_client/discovery.py
+++ b/python-discovery-client/discovery_client/discovery.py
@@ -222,9 +222,7 @@ def _resolve_name(lookup_func, service_name):
# TODO: Need a better way to identify CDAP apps. Really need to make this
# better.
- if "platform-" in service_name:
- return "{0}:{1}".format(ip, port)
- elif "cdap" in service_name:
+ if "cdap" in service_name:
redirectish_url = "http://{0}:{1}/application/{2}".format(ip, port,
service_name)
diff --git a/python-discovery-client/pom.xml b/python-discovery-client/pom.xml
index 39b5da5..d6a87f8 100644
--- a/python-discovery-client/pom.xml
+++ b/python-discovery-client/pom.xml
@@ -26,27 +26,21 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.utils</groupId>
- <artifactId>onap-dcae-discovery-client</artifactId>
+ <artifactId>python-discovery-client</artifactId>
<name>dcaegen2-utils-python-discovery-client</name>
<version>1.0.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
<sonar.sources>.</sonar.sources>
- <!-- customize the SONARQUBE URL -->
- <!-- sonar.host.url>http://localhost:9000</sonar.host.url -->
- <!-- below are language dependent -->
- <!-- for Python -->
+ <sonar.junit.reportsPath>xunit-results.xml</sonar.junit.reportsPath>
+ <sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <!-- for JavaScaript -->
- <!--
- <sonar.language>js</sonar.language>
- <sonar.pluginName>JS</sonar.pluginName>
- <sonar.inclusions>**/*.js</sonar.inclusions>
- -->
+ <sonar.exclusions>tests/*</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/python-discovery-client/tests/test_discovery.py b/python-discovery-client/tests/test_discovery.py
index 00f1b5e..36817af 100644
--- a/python-discovery-client/tests/test_discovery.py
+++ b/python-discovery-client/tests/test_discovery.py
@@ -17,7 +17,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json, logging
+import six, json, logging
# http://stackoverflow.com/questions/9623114/check-if-two-unordered-lists-are-equal
from collections import Counter
from functools import partial
@@ -65,8 +65,8 @@ def test_get_connection_types():
assert Counter(expected) == Counter(actual)
# Force strings to be unicode, test for Python2 compatibility
- config = { "x": "say something".decode("utf-8"), "y": 123,
- "z": "{{some-analytics}}".decode("utf-8") }
+ config = { "x": six.u("say something"), "y": 123,
+ "z": six.u("{{some-analytics}}") }
expected = [(("z", ), "some-analytics"), ]
actual = dis._get_connection_types(config)
assert Counter(expected) == Counter(actual)
diff --git a/python-discovery-client/tox.ini b/python-discovery-client/tox.ini
index 987b009..5b492c9 100644
--- a/python-discovery-client/tox.ini
+++ b/python-discovery-client/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}/discovery_client --cov-report=xml