From 10c1f99f8d16196e2898c11f9b5c1d3f0735807a Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Wed, 15 Jun 2016 17:42:59 +0200 Subject: Try/except ODL push to DB until ODL tests are refactored Change-Id: I7919c69655ce43831d5269afc1d86bf2c929bb8f Signed-off-by: Morgan Richomme --- testcases/Controllers/ODL/odlreport2db.py | 43 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'testcases/Controllers/ODL') diff --git a/testcases/Controllers/ODL/odlreport2db.py b/testcases/Controllers/ODL/odlreport2db.py index 3eff40060..075de5a86 100644 --- a/testcases/Controllers/ODL/odlreport2db.py +++ b/testcases/Controllers/ODL/odlreport2db.py @@ -110,17 +110,17 @@ def main(argv): # dictionary populated with data from xml file all_data = xmltodict.parse(xml_input)['robot'] - data = parse_suites(all_data['suite']['suite']) - data['description'] = all_data['suite']['@name'] - data['version'] = all_data['@generator'] - data['test_project'] = "functest" - data['case_name'] = "ODL" - data['pod_name'] = pod - data['installer'] = installer + try: + data = parse_suites(all_data['suite']['suite']) + data['description'] = all_data['suite']['@name'] + data['version'] = all_data['@generator'] + data['test_project'] = "functest" + data['case_name'] = "ODL" + data['pod_name'] = pod + data['installer'] = installer - json.dumps(data, indent=4, separators=(',', ': ')) + json.dumps(data, indent=4, separators=(',', ': ')) - try: # example: # python odlreport2db.py -x ~/Pictures/Perso/odl/output3.xml # -i fuel @@ -133,19 +133,16 @@ def main(argv): # start and stoptime have no real meaning start_time = time.time() stop_time = start_time - try: - tests_passed = 0 - tests_failed = 0 - for v in data['details']: - if v['test_status']['@status'] == "PASS": - tests_passed += 1 - else: - tests_failed += 1 - - if (tests_failed < 1): - status = "PASS" - except: - print("Unable to set criteria" % sys.exc_info()[0]) + tests_passed = 0 + tests_failed = 0 + for v in data['details']: + if v['test_status']['@status'] == "PASS": + tests_passed += 1 + else: + tests_failed += 1 + + if (tests_failed < 1): + status = "PASS" functest_utils.push_results_to_db("functest", data['case_name'], @@ -156,7 +153,7 @@ def main(argv): data) except: - print("Error pushing results into Database '%s'" % sys.exc_info()[0]) + print("Error pushing ODL results into DB '%s'" % sys.exc_info()[0]) if __name__ == "__main__": -- cgit 1.2.3-korg