mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add --failure-ok
option to ansible-test
. (#22623)
This commit is contained in:
parent
2e28173d49
commit
89559f78de
5 changed files with 26 additions and 16 deletions
|
@ -712,8 +712,13 @@ def command_compile(args):
|
|||
failed.append('compile --python %s' % version)
|
||||
|
||||
if failed:
|
||||
raise ApplicationError('The %d compile test(s) listed below (out of %d) failed. See error output above for details.\n%s' % (
|
||||
len(failed), total, '\n'.join(failed)))
|
||||
message = 'The %d compile test(s) listed below (out of %d) failed. See error output above for details.\n%s' % (
|
||||
len(failed), total, '\n'.join(failed))
|
||||
|
||||
if args.failure_ok:
|
||||
display.error(message)
|
||||
else:
|
||||
raise ApplicationError(message)
|
||||
|
||||
|
||||
def compile_version(args, python_version, include, exclude):
|
||||
|
|
|
@ -114,8 +114,13 @@ def command_sanity(args):
|
|||
failed.append(result.test + options)
|
||||
|
||||
if failed:
|
||||
raise ApplicationError('The %d sanity test(s) listed below (out of %d) failed. See error output above for details.\n%s' % (
|
||||
len(failed), total, '\n'.join(failed)))
|
||||
message = 'The %d sanity test(s) listed below (out of %d) failed. See error output above for details.\n%s' % (
|
||||
len(failed), total, '\n'.join(failed))
|
||||
|
||||
if args.failure_ok:
|
||||
display.error(message)
|
||||
else:
|
||||
raise ApplicationError(message)
|
||||
|
||||
|
||||
def command_sanity_code_smell(args, _, script):
|
||||
|
|
|
@ -36,6 +36,7 @@ class TestConfig(EnvironmentConfig):
|
|||
|
||||
self.lint = args.lint if 'lint' in args else False # type: bool
|
||||
self.junit = args.junit if 'junit' in args else False # type: bool
|
||||
self.failure_ok = args.failure_ok if 'failure_ok' in args else False # type: bool
|
||||
|
||||
|
||||
class TestResult(object):
|
||||
|
@ -266,7 +267,7 @@ class TestFailure(TestResult):
|
|||
if args.explain:
|
||||
return
|
||||
|
||||
with open(path, 'wb') as bot_fd:
|
||||
with open(path, 'w') as bot_fd:
|
||||
json.dump(bot_data, bot_fd, indent=4, sort_keys=True)
|
||||
bot_fd.write('\n')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue