Overhaul ansible-test sanity implementation. (#22177)

- Tests are run to completion instead of stopping on first failure.
- Test results are now parsed instead of passing through to the console.
- Test results can be saved in junit xml format.
- Test results will show up on the Shippable "Tests" result tab.
- Added an experimental --lint option for easier integration with other tools.
- Code smell tests are now usable with the --list-tests, --test and --skip-test options.
- Code split out from executor.py into sanity.py.
- Rename download-logs to download.py and add support for test and coverage results.
- Miscellaneous improvements.
This commit is contained in:
Matt Clay 2017-03-02 12:36:46 -08:00 committed by GitHub
parent 237411613d
commit d66ce40ecb
9 changed files with 1070 additions and 459 deletions

View file

@ -287,6 +287,8 @@ class Display(object):
self.verbosity = 0
self.color = True
self.warnings = []
self.warnings_unique = set()
self.info_stderr = False
def __warning(self, message):
"""
@ -304,10 +306,17 @@ class Display(object):
for warning in self.warnings:
self.__warning(warning)
def warning(self, message):
def warning(self, message, unique=False):
"""
:type message: str
:type unique: bool
"""
if unique:
if message in self.warnings_unique:
return
self.warnings_unique.add(message)
self.__warning(message)
self.warnings.append(message)
@ -330,7 +339,7 @@ class Display(object):
"""
if self.verbosity >= verbosity:
color = self.verbosity_colors.get(verbosity, self.yellow)
self.print_message(message, color=color)
self.print_message(message, color=color, fd=sys.stderr if self.info_stderr else sys.stdout)
def print_message(self, message, color=None, fd=sys.stdout): # pylint: disable=locally-disabled, invalid-name
"""