From dd79a38607c40db86de950b4c1ecdff443fe68f4 Mon Sep 17 00:00:00 2001 From: Mickael JEZEQUEL Date: Thu, 8 Mar 2018 16:18:04 +0100 Subject: fix sonar job configuration Change-Id: I437da70e82fe970f8455bb45e9454959ec6cfc3c Issue-ID: VNFSDK-39 Signed-off-by: Mickael JEZEQUEL --- .gitignore | 1 + ice-server/heat_test/app.py | 20 +------------------- ice-server/heat_test/test/test_api.py | 2 +- ice-server/pom.xml | 11 +++++++---- ice-server/setup.py | 4 ++-- ice-server/tox.ini | 10 +++++----- validation-scripts/pom.xml | 10 ++++++---- validation-scripts/tox.ini | 13 ++----------- 8 files changed, 25 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 1a479f6..252574b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Byte-compiled / optimized / DLL files __pycache__/ +.pytest_cache/ *.py[cod] *$py.class diff --git a/ice-server/heat_test/app.py b/ice-server/heat_test/app.py index e982c68..c61150a 100644 --- a/ice-server/heat_test/app.py +++ b/ice-server/heat_test/app.py @@ -7,25 +7,6 @@ import connexion from connexion.resolver import RestyResolver -def parse_args(): - """ - parse argument parameters - """ - parser = argparse.ArgumentParser(description='start the heat validation rest server') - parser.add_argument("--debug", help="increase output verbosity") - parser.add_argument("-p", "--port", type=int, help="listen port (default 5000)", default=5000) - args = parser.parse_args() - if args.debug: - logging.info("debug mode") - debug = True - else: - debug = False - if args.port: - port = args.port - else: - port = 5000 - - def create_app(): logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') app = connexion.App(__name__, specification_dir='swagger/') @@ -37,6 +18,7 @@ def create_app(): return app + def create_test_app(): print("create_test_app") logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') diff --git a/ice-server/heat_test/test/test_api.py b/ice-server/heat_test/test/test_api.py index 259a43b..25f017b 100644 --- a/ice-server/heat_test/test/test_api.py +++ b/ice-server/heat_test/test/test_api.py @@ -15,7 +15,7 @@ print(sys.path) import app as myapp -ICE_URL = '/ice/' +ICE_URL = '/onapapi/ice/v1/' flask_app = myapp.create_test_app() diff --git a/ice-server/pom.xml b/ice-server/pom.xml index 3e6d2a5..26f8495 100644 --- a/ice-server/pom.xml +++ b/ice-server/pom.xml @@ -30,9 +30,12 @@ under the License. ice rest API rest API for HEAT template validation - py - Python - **/*.py - false + . + coverage.xml + py + Python + **/*.py + version.py,setup.py + diff --git a/ice-server/setup.py b/ice-server/setup.py index b4c5aea..eacf048 100644 --- a/ice-server/setup.py +++ b/ice-server/setup.py @@ -20,8 +20,8 @@ import os from setuptools import setup, find_packages import sys -if sys.version_info < (2, 7): - sys.exit('VNF SDK requires Python 2.7+') +if sys.version_info < (3, 0): + sys.exit('VNF SDK requires Python 3.0+') root_dir = os.path.dirname(__file__) install_requires = [] diff --git a/ice-server/tox.ini b/ice-server/tox.ini index 8da170d..afae937 100644 --- a/ice-server/tox.ini +++ b/ice-server/tox.ini @@ -40,14 +40,14 @@ [tox] skipsdist=True -envlist = py3 +envlist = py35 [testenv] distribute = False commands = {envpython} --version - pytest + coverage run --module pytest heat_test + coverage xml deps = -rrequirements.txt - -[testenv:py3] -basepython=python3.5 + coverage + pytest-cov diff --git a/validation-scripts/pom.xml b/validation-scripts/pom.xml index a08f8af..3b13708 100644 --- a/validation-scripts/pom.xml +++ b/validation-scripts/pom.xml @@ -30,10 +30,12 @@ under the License. vnfsdk-ice-scripts python scripts for HEAT template validation - py - Python - **/*.py - false + . + coverage.xml + py + Python + **/*.py + version.py,setup.py diff --git a/validation-scripts/tox.ini b/validation-scripts/tox.ini index 882140f..62964eb 100644 --- a/validation-scripts/tox.ini +++ b/validation-scripts/tox.ini @@ -40,7 +40,7 @@ [tox] skipsdist=True -envlist = py27,py3,style +envlist = py27,py35 [testenv] distribute = False @@ -48,16 +48,7 @@ commands = {envpython} --version pytest --version coverage run --module pytest ice_validator --self-test -rxXs - coverage report + coverage xml deps = -rrequirements.txt - flake8 coverage -[testenv:style] -commands = flake8 ice_validator - -[testenv:py27] -basepython=python2.7 - -[testenv:py3] -basepython=python3.6 -- cgit 1.2.3-korg