|
|
@ -136,10 +136,8 @@ def filter_targets(targets: c.Iterable[TCompletionTarget],
|
|
|
|
raise TargetPatternsNotMatched(unmatched)
|
|
|
|
raise TargetPatternsNotMatched(unmatched)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def walk_module_targets():
|
|
|
|
def walk_module_targets() -> c.Iterable[TestTarget]:
|
|
|
|
"""
|
|
|
|
"""Iterate through the module test targets."""
|
|
|
|
:rtype: collections.Iterable[TestTarget]
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
for target in walk_test_targets(path=data_context().content.module_path, module_path=data_context().content.module_path, extensions=MODULE_EXTENSIONS):
|
|
|
|
for target in walk_test_targets(path=data_context().content.module_path, module_path=data_context().content.module_path, extensions=MODULE_EXTENSIONS):
|
|
|
|
if not target.module:
|
|
|
|
if not target.module:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
@ -244,10 +242,8 @@ def walk_integration_targets() -> c.Iterable[IntegrationTarget]:
|
|
|
|
yield IntegrationTarget(to_text(path), modules, prefixes)
|
|
|
|
yield IntegrationTarget(to_text(path), modules, prefixes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_integration_prefixes():
|
|
|
|
def load_integration_prefixes() -> dict[str, str]:
|
|
|
|
"""
|
|
|
|
"""Load and return the integration test prefixes."""
|
|
|
|
:rtype: dict[str, str]
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
path = data_context().content.integration_path
|
|
|
|
path = data_context().content.integration_path
|
|
|
|
file_paths = sorted(f for f in data_context().content.get_files(path) if os.path.splitext(os.path.basename(f))[0] == 'target-prefixes')
|
|
|
|
file_paths = sorted(f for f in data_context().content.get_files(path) if os.path.splitext(os.path.basename(f))[0] == 'target-prefixes')
|
|
|
|
prefixes = {}
|
|
|
|
prefixes = {}
|
|
|
@ -313,7 +309,7 @@ def analyze_integration_target_dependencies(integration_targets: list[Integratio
|
|
|
|
role_targets = [target for target in integration_targets if target.type == 'role']
|
|
|
|
role_targets = [target for target in integration_targets if target.type == 'role']
|
|
|
|
hidden_role_target_names = set(target.name for target in role_targets if 'hidden/' in target.aliases)
|
|
|
|
hidden_role_target_names = set(target.name for target in role_targets if 'hidden/' in target.aliases)
|
|
|
|
|
|
|
|
|
|
|
|
dependencies = collections.defaultdict(set)
|
|
|
|
dependencies: collections.defaultdict[str, set[str]] = collections.defaultdict(set)
|
|
|
|
|
|
|
|
|
|
|
|
# handle setup dependencies
|
|
|
|
# handle setup dependencies
|
|
|
|
for target in integration_targets:
|
|
|
|
for target in integration_targets:
|
|
|
@ -405,12 +401,12 @@ def analyze_integration_target_dependencies(integration_targets: list[Integratio
|
|
|
|
|
|
|
|
|
|
|
|
class CompletionTarget(metaclass=abc.ABCMeta):
|
|
|
|
class CompletionTarget(metaclass=abc.ABCMeta):
|
|
|
|
"""Command-line argument completion target base class."""
|
|
|
|
"""Command-line argument completion target base class."""
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.name = None
|
|
|
|
self.name = ''
|
|
|
|
self.path = None
|
|
|
|
self.path = ''
|
|
|
|
self.base_path = None
|
|
|
|
self.base_path: t.Optional[str] = None
|
|
|
|
self.modules = tuple()
|
|
|
|
self.modules: tuple[str, ...] = tuple()
|
|
|
|
self.aliases = tuple()
|
|
|
|
self.aliases: tuple[str, ...] = tuple()
|
|
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
def __eq__(self, other):
|
|
|
|
if isinstance(other, CompletionTarget):
|
|
|
|
if isinstance(other, CompletionTarget):
|
|
|
@ -446,7 +442,7 @@ class TestTarget(CompletionTarget):
|
|
|
|
module_prefix: t.Optional[str],
|
|
|
|
module_prefix: t.Optional[str],
|
|
|
|
base_path: str,
|
|
|
|
base_path: str,
|
|
|
|
symlink: t.Optional[bool] = None,
|
|
|
|
symlink: t.Optional[bool] = None,
|
|
|
|
):
|
|
|
|
) -> None:
|
|
|
|
super().__init__()
|
|
|
|
super().__init__()
|
|
|
|
|
|
|
|
|
|
|
|
if symlink is None:
|
|
|
|
if symlink is None:
|
|
|
@ -665,8 +661,6 @@ class IntegrationTarget(CompletionTarget):
|
|
|
|
|
|
|
|
|
|
|
|
target_type, actual_type = categorize_integration_test(self.name, list(static_aliases), force_target)
|
|
|
|
target_type, actual_type = categorize_integration_test(self.name, list(static_aliases), force_target)
|
|
|
|
|
|
|
|
|
|
|
|
self._remove_group(groups, 'context')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
groups.extend(['context/', f'context/{target_type.name.lower()}'])
|
|
|
|
groups.extend(['context/', f'context/{target_type.name.lower()}'])
|
|
|
|
|
|
|
|
|
|
|
|
if target_type != actual_type:
|
|
|
|
if target_type != actual_type:
|
|
|
@ -695,10 +689,6 @@ class IntegrationTarget(CompletionTarget):
|
|
|
|
self.setup_always = tuple(sorted(set(g.split('/')[2] for g in groups if g.startswith('setup/always/'))))
|
|
|
|
self.setup_always = tuple(sorted(set(g.split('/')[2] for g in groups if g.startswith('setup/always/'))))
|
|
|
|
self.needs_target = tuple(sorted(set(g.split('/')[2] for g in groups if g.startswith('needs/target/'))))
|
|
|
|
self.needs_target = tuple(sorted(set(g.split('/')[2] for g in groups if g.startswith('needs/target/'))))
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def _remove_group(groups, group):
|
|
|
|
|
|
|
|
return [g for g in groups if g != group and not g.startswith('%s/' % group)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TargetPatternsNotMatched(ApplicationError):
|
|
|
|
class TargetPatternsNotMatched(ApplicationError):
|
|
|
|
"""One or more targets were not matched when a match was required."""
|
|
|
|
"""One or more targets were not matched when a match was required."""
|
|
|
|