diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2017-02-14 14:37:05 +0100 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2017-02-14 16:58:05 +0100 |
commit | e73000209d46461b1196f560bf5c36bade020134 (patch) | |
tree | 6a09e8a127d777815378ef833824f924df82875c /utils/test/reporting | |
parent | e5f30e9839c4e36d7712b0e7dd3c319a85048322 (diff) |
Fix flake8 violations in releng
Change-Id: I45769ff9c9db2de9fbba69117a92de414dd7f651
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'utils/test/reporting')
-rwxr-xr-x | utils/test/reporting/functest/reporting-tempest.py | 8 | ||||
-rwxr-xr-x | utils/test/reporting/functest/reporting-vims.py | 4 | ||||
-rw-r--r-- | utils/test/reporting/functest/testCase.py | 33 | ||||
-rw-r--r-- | utils/test/reporting/utils/reporting_utils.py | 28 |
4 files changed, 36 insertions, 37 deletions
diff --git a/utils/test/reporting/functest/reporting-tempest.py b/utils/test/reporting/functest/reporting-tempest.py index 5d6bcc062..6e6585a32 100755 --- a/utils/test/reporting/functest/reporting-tempest.py +++ b/utils/test/reporting/functest/reporting-tempest.py @@ -44,7 +44,7 @@ for version in rp_utils.get_config('general.versions'): response = urlopen(request) k = response.read() results = json.loads(k) - except URLError, e: + except URLError as e: logger.error("Error code: %s" % e) test_results = results['results'] @@ -73,9 +73,9 @@ for version in rp_utils.get_config('general.versions'): nb_tests_run = result['details']['tests'] nb_tests_failed = result['details']['failures'] if nb_tests_run != 0: - success_rate = 100*((int(nb_tests_run) - - int(nb_tests_failed)) / - int(nb_tests_run)) + success_rate = 100 * ((int(nb_tests_run) - + int(nb_tests_failed)) / + int(nb_tests_run)) else: success_rate = 0 diff --git a/utils/test/reporting/functest/reporting-vims.py b/utils/test/reporting/functest/reporting-vims.py index 2077d2a4a..b236b8963 100755 --- a/utils/test/reporting/functest/reporting-vims.py +++ b/utils/test/reporting/functest/reporting-vims.py @@ -51,7 +51,7 @@ for version in versions: response = urlopen(request) k = response.read() results = json.loads(k) - except URLError, e: + except URLError as e: logger.error("Error code: %s" % e) test_results = results['results'] @@ -91,7 +91,7 @@ for version in versions: result['pr_step_ok'] = 0 if nb_step != 0: - result['pr_step_ok'] = (float(nb_step_ok)/nb_step)*100 + result['pr_step_ok'] = (float(nb_step_ok) / nb_step) * 100 try: logger.debug("Scenario %s, Installer %s" % (s_result[1]['scenario'], installer)) diff --git a/utils/test/reporting/functest/testCase.py b/utils/test/reporting/functest/testCase.py index 8d90fc861..df0874e0b 100644 --- a/utils/test/reporting/functest/testCase.py +++ b/utils/test/reporting/functest/testCase.py @@ -36,14 +36,14 @@ class TestCase(object): 'moon': 'Moon', 'copper': 'Copper', 'security_scan': 'Security', - 'multisite':'Multisite', - 'domino':'Domino', - 'odl-sfc':'SFC', - 'onos_sfc':'SFC', - 'parser':'Parser', - 'connection_check':'Health (connection)', - 'api_check':'Health (api)', - 'snaps_smoke':'SNAPS' } + 'multisite': 'Multisite', + 'domino': 'Domino', + 'odl-sfc': 'SFC', + 'onos_sfc': 'SFC', + 'parser': 'Parser', + 'connection_check': 'Health (connection)', + 'api_check': 'Health (api)', + 'snaps_smoke': 'SNAPS'} try: self.displayName = display_name_matrix[self.name] except: @@ -131,14 +131,14 @@ class TestCase(object): 'moon': 'moon_authentication', 'copper': 'copper-notification', 'security_scan': 'security', - 'multisite':'multisite', - 'domino':'domino-multinode', - 'odl-sfc':'functest-odl-sfc', - 'onos_sfc':'onos_sfc', - 'parser':'parser-basics', - 'connection_check':'connection_check', - 'api_check':'api_check', - 'snaps_smoke':'snaps_smoke' + 'multisite': 'multisite', + 'domino': 'domino-multinode', + 'odl-sfc': 'functest-odl-sfc', + 'onos_sfc': 'onos_sfc', + 'parser': 'parser-basics', + 'connection_check': 'connection_check', + 'api_check': 'api_check', + 'snaps_smoke': 'snaps_smoke' } try: return test_match_matrix[self.name] @@ -147,4 +147,3 @@ class TestCase(object): def getDisplayName(self): return self.displayName - diff --git a/utils/test/reporting/utils/reporting_utils.py b/utils/test/reporting/utils/reporting_utils.py index da979531b..fc5d188af 100644 --- a/utils/test/reporting/utils/reporting_utils.py +++ b/utils/test/reporting/utils/reporting_utils.py @@ -93,8 +93,8 @@ def getApiResults(case, installer, scenario, version): response = urlopen(request) k = response.read() results = json.loads(k) - except URLError, e: - print 'No kittez. Got an error code:', e + except URLError as e: + print('No kittez. Got an error code:', e) return results @@ -115,8 +115,8 @@ def getScenarios(case, installer, version): k = response.read() results = json.loads(k) test_results = results['results'] - except URLError, e: - print 'Got an error code:', e + except URLError as e: + print('Got an error code:', e) if test_results is not None: test_results.reverse() @@ -132,8 +132,8 @@ def getScenarios(case, installer, version): exclude_virtual_pod = get_config('functest.exclude_virtual') exclude_noha = get_config('functest.exclude_noha') if ((exclude_virtual_pod and "virtual" in r['pod_name']) or - (exclude_noha and "noha" in r['scenario'])): - print "exclude virtual pod results..." + (exclude_noha and "noha" in r['scenario'])): + print("exclude virtual pod results...") else: scenario_results[r['scenario']].append(r) @@ -164,8 +164,8 @@ def getScenarioStatus(installer, version): response.close() results = json.loads(k) test_results = results['results'] - except URLError, e: - print 'Got an error code:', e + except URLError as e: + print('Got an error code:', e) scenario_results = {} result_dict = {} @@ -198,7 +198,7 @@ def getNbtestOk(results): if "PASS" in v: nb_test_ok += 1 except: - print "Cannot retrieve test status" + print("Cannot retrieve test status") return nb_test_ok @@ -269,10 +269,10 @@ def getJenkinsUrl(build_tag): url_base = get_config('functest.jenkins_url') try: build_id = [int(s) for s in build_tag.split("-") if s.isdigit()] - url_id = build_tag[8:-(len(build_id)+3)] + "/" + str(build_id[0]) + url_id = build_tag[8:-(len(build_id) + 3)] + "/" + str(build_id[0]) jenkins_url = url_base + url_id + "/console" except: - print 'Impossible to get jenkins url:' + print('Impossible to get jenkins url:') return jenkins_url @@ -282,7 +282,7 @@ def getScenarioPercent(scenario_score, scenario_criteria): try: score = float(scenario_score) / float(scenario_criteria) * 100 except: - print 'Impossible to calculate the percentage score' + print('Impossible to calculate the percentage score') return score @@ -330,8 +330,8 @@ def get_percent(four_list, ten_list): def _test(): status = getScenarioStatus("compass", "master") - print "status:++++++++++++++++++++++++" - print json.dumps(status, indent=4) + print("status:++++++++++++++++++++++++") + print(json.dumps(status, indent=4)) # ---------------------------------------------------------- |