ansible-test local change detection: use --base-branch if specified (#69508)
This commit is contained in:
parent
ecea15c508
commit
43acd61901
4 changed files with 10 additions and 6 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "ansible-test - for local change detection, allow to specify branch to compare to with ``--base-branch`` for all types of tests (https://github.com/ansible/ansible/pull/69508)."
|
|
@ -203,9 +203,11 @@ class LocalChanges:
|
||||||
# diff of all tracked files from fork point to working copy
|
# diff of all tracked files from fork point to working copy
|
||||||
self.diff = self.git.get_diff([self.fork_point])
|
self.diff = self.git.get_diff([self.fork_point])
|
||||||
|
|
||||||
@staticmethod
|
def is_official_branch(self, name): # type: (str) -> bool
|
||||||
def is_official_branch(name): # type: (str) -> bool
|
|
||||||
"""Return True if the given branch name an official branch for development or releases."""
|
"""Return True if the given branch name an official branch for development or releases."""
|
||||||
|
if self.args.base_branch:
|
||||||
|
return name == self.args.base_branch
|
||||||
|
|
||||||
if name == 'devel':
|
if name == 'devel':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,9 @@ def parse_args():
|
||||||
test.add_argument('--metadata',
|
test.add_argument('--metadata',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
|
test.add_argument('--base-branch',
|
||||||
|
help='base branch used for change detection')
|
||||||
|
|
||||||
add_changes(test, argparse)
|
add_changes(test, argparse)
|
||||||
add_environments(test)
|
add_environments(test)
|
||||||
|
|
||||||
|
@ -527,9 +530,6 @@ def parse_args():
|
||||||
choices=SUPPORTED_PYTHON_VERSIONS + ('default',),
|
choices=SUPPORTED_PYTHON_VERSIONS + ('default',),
|
||||||
help='python version: %s' % ', '.join(SUPPORTED_PYTHON_VERSIONS))
|
help='python version: %s' % ', '.join(SUPPORTED_PYTHON_VERSIONS))
|
||||||
|
|
||||||
sanity.add_argument('--base-branch',
|
|
||||||
help=argparse.SUPPRESS)
|
|
||||||
|
|
||||||
sanity.add_argument('--enable-optional-errors',
|
sanity.add_argument('--enable-optional-errors',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='enable optional errors')
|
help='enable optional errors')
|
||||||
|
|
|
@ -193,6 +193,7 @@ class TestConfig(EnvironmentConfig):
|
||||||
self.unstaged = args.unstaged # type: bool
|
self.unstaged = args.unstaged # type: bool
|
||||||
self.changed_from = args.changed_from # type: str
|
self.changed_from = args.changed_from # type: str
|
||||||
self.changed_path = args.changed_path # type: t.List[str]
|
self.changed_path = args.changed_path # type: t.List[str]
|
||||||
|
self.base_branch = args.base_branch # type: str
|
||||||
|
|
||||||
self.lint = args.lint if 'lint' in args else False # type: bool
|
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.junit = args.junit if 'junit' in args else False # type: bool
|
||||||
|
@ -241,7 +242,6 @@ class SanityConfig(TestConfig):
|
||||||
self.list_tests = args.list_tests # type: bool
|
self.list_tests = args.list_tests # type: bool
|
||||||
self.allow_disabled = args.allow_disabled # type: bool
|
self.allow_disabled = args.allow_disabled # type: bool
|
||||||
self.enable_optional_errors = args.enable_optional_errors # type: bool
|
self.enable_optional_errors = args.enable_optional_errors # type: bool
|
||||||
self.base_branch = args.base_branch # type: str
|
|
||||||
self.info_stderr = self.lint
|
self.info_stderr = self.lint
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue