diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2016-08-22 11:48:44 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2016-08-22 12:05:00 +0200 |
commit | 4fcf3d2079e505a6337abe1b850c7a7f6afddada (patch) | |
tree | d2dfe68b7290fb111f4f5342d5ee8c1d0bd4bba0 /testcases/Controllers/ODL/OpenDaylightTesting.py | |
parent | 5f450302301af5f19e4fee7cf37d2c724e098dea (diff) |
Improve errors and status codes management
Run returns the number of errors which is irrelevant to catch as
they are published to DB. Useless generated files are desactivated too.
Change-Id: I2baf6d5242c5f4095302a47ff90272fb95103457
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'testcases/Controllers/ODL/OpenDaylightTesting.py')
-rwxr-xr-x | testcases/Controllers/ODL/OpenDaylightTesting.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py index 74e3157dc..c9c658ee6 100755 --- a/testcases/Controllers/ODL/OpenDaylightTesting.py +++ b/testcases/Controllers/ODL/OpenDaylightTesting.py @@ -59,7 +59,8 @@ class ODLTestCases: shutil.copy(f, cls.neutron_suite_dir) except IOError as e: cls.logger.error( - "Cannot copy OPNFV's testcases to ODL directory", e) + "Cannot copy OPNFV's testcases to ODL directory: " + "%s" % e.strerror) return False return True @@ -94,7 +95,8 @@ class ODLTestCases: 'PORT:' + kwargs['odlwebport'], 'RESTCONFPORT:' + kwargs['odlrestconfport']] except KeyError as e: - cls.logger.error("Cannot run ODL testcases. Please check", e) + cls.logger.error("Cannot run ODL testcases. Please check " + "%s" % e.strerror) return False if (cls.copy_opnf_testcases() and cls.set_robotframework_vars(odlusername, odlpassword)): @@ -104,16 +106,14 @@ class ODLTestCases: pass stdout_file = cls.res_dir + 'stdout.txt' with open(stdout_file, 'w') as stdout: - result = run(*dirs, variable=variables, - output=cls.res_dir + 'output.xml', - log=cls.res_dir + 'log.html', - report=cls.res_dir + 'report.html', - stdout=stdout) - + run(*dirs, variable=variables, + output=cls.res_dir + 'output.xml', + log='NONE', + report='NONE', + stdout=stdout) with open(stdout_file, 'r') as stdout: cls.logger.info("\n" + stdout.read()) - - return result + return True else: return False @@ -176,7 +176,8 @@ if __name__ == '__main__': action='store_true') args = vars(parser.parse_args()) - ODLTestCases.run(**args) + if not ODLTestCases.run(**args): + sys.exit(os.EX_SOFTWARE) if args['pushtodb']: sys.exit(not ODLTestCases.push_to_db()) sys.exit(os.EX_OK) |