Multiple ansible-test fixes. (#38247)

* Add ansible-test integration --allow-root option.
* Fix destructive target override.
* Fix bad type hint SanityResult -> TestResult.
* Fix skip/python3 filtering with --docker option.
This commit is contained in:
Matt Clay 2018-04-03 18:53:53 -07:00 committed by GitHub
parent f37a44430f
commit a5cbc0a2c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 32 additions and 25 deletions

View file

@ -220,7 +220,7 @@ class SanityCodeSmellTest(SanityTest):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
if self.path.endswith('.py'):
cmd = [args.python_executable, self.path]
@ -327,7 +327,7 @@ class SanitySingleVersion(SanityFunc):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
pass
@ -340,7 +340,7 @@ class SanityMultipleVersion(SanityFunc):
:type args: SanityConfig
:type targets: SanityTargets
:type python_version: str
:rtype: SanityResult
:rtype: TestResult
"""
pass

View file

@ -33,7 +33,7 @@ class AnsibleDocTest(SanityMultipleVersion):
:type args: SanityConfig
:type targets: SanityTargets
:type python_version: str
:rtype: SanityResult
:rtype: TestResult
"""
with open('test/sanity/ansible-doc/skip.txt', 'r') as skip_fd:
skip_modules = set(skip_fd.read().splitlines())

View file

@ -35,7 +35,7 @@ class CompileTest(SanityMultipleVersion):
:type args: SanityConfig
:type targets: SanityTargets
:type python_version: str
:rtype: SanityResult
:rtype: TestResult
"""
# optional list of regex patterns to exclude from tests
skip_file = 'test/sanity/compile/python%s-skip.txt' % python_version

View file

@ -41,7 +41,7 @@ class ImportTest(SanityMultipleVersion):
:type args: SanityConfig
:type targets: SanityTargets
:type python_version: str
:rtype: SanityResult
:rtype: TestResult
"""
with open('test/sanity/import/skip.txt', 'r') as skip_fd:
skip_paths = skip_fd.read().splitlines()

View file

@ -35,7 +35,7 @@ class Pep8Test(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
with open(PEP8_SKIP_PATH, 'r') as skip_fd:
skip_paths = skip_fd.read().splitlines()

View file

@ -39,7 +39,7 @@ class PslintTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
with open(PSLINT_SKIP_PATH, 'r') as skip_fd:
skip_paths = skip_fd.read().splitlines()

View file

@ -63,7 +63,7 @@ class PylintTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
if args.python_version in UNSUPPORTED_PYTHON_VERSIONS:
display.warning('Skipping pylint on unsupported Python version %s.' % args.python_version)

View file

@ -34,7 +34,7 @@ class RstcheckTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
if args.python_version in UNSUPPORTED_PYTHON_VERSIONS:
display.warning('Skipping rstcheck on unsupported Python version %s.' % args.python_version)

View file

@ -23,7 +23,7 @@ class SanityDocsTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
sanity_dir = 'docs/docsite/rst/dev_guide/testing/sanity'
sanity_docs = set(part[0] for part in (os.path.splitext(name) for name in os.listdir(sanity_dir)) if part[1] == '.rst')

View file

@ -32,7 +32,7 @@ class ShellcheckTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
with open('test/sanity/shellcheck/skip.txt', 'r') as skip_fd:
skip_paths = set(skip_fd.read().splitlines())

View file

@ -42,7 +42,7 @@ class ValidateModulesTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
with open(VALIDATE_SKIP_PATH, 'r') as skip_fd:
skip_paths = skip_fd.read().splitlines()

View file

@ -29,7 +29,7 @@ class YamllintTest(SanitySingleVersion):
"""
:type args: SanityConfig
:type targets: SanityTargets
:rtype: SanityResult
:rtype: TestResult
"""
paths = [
[i.path for i in targets.include if os.path.splitext(i.path)[1] in ('.yml', '.yaml')],