summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2021-11-19 12:33:41 -0800
committerMatt Clay <matt@mystile.com>2022-01-05 10:04:06 -0800
commitd2daa67b0079a69bee9be139bea1242e22427686 (patch)
treebac4e66c6b8fce1c8910b61d873c03b21e95a021 /test/lib/ansible_test
parent16def8050a38510fe3e477a943a90a47a1bf3c8a (diff)
downloadansible-d2daa67b0079a69bee9be139bea1242e22427686.tar.gz
ansible-test - Fix type hints.
Diffstat (limited to 'test/lib/ansible_test')
-rw-r--r--test/lib/ansible_test/_internal/cli/commands/integration/network.py2
-rw-r--r--test/lib/ansible_test/_internal/cli/completers.py4
-rw-r--r--test/lib/ansible_test/_internal/cli/environments.py10
-rw-r--r--test/lib/ansible_test/_internal/commands/coverage/__init__.py4
-rw-r--r--test/lib/ansible_test/_internal/commands/coverage/xml.py2
-rw-r--r--test/lib/ansible_test/_internal/containers.py2
-rw-r--r--test/lib/ansible_test/_internal/docker_util.py2
-rw-r--r--test/lib/ansible_test/_internal/provider/__init__.py2
-rw-r--r--test/lib/ansible_test/_internal/target.py2
9 files changed, 15 insertions, 15 deletions
diff --git a/test/lib/ansible_test/_internal/cli/commands/integration/network.py b/test/lib/ansible_test/_internal/cli/commands/integration/network.py
index d070afda9b..425a81520a 100644
--- a/test/lib/ansible_test/_internal/cli/commands/integration/network.py
+++ b/test/lib/ansible_test/_internal/cli/commands/integration/network.py
@@ -60,7 +60,7 @@ def do_network_integration(
add_environments(parser, completer, ControllerMode.DELEGATED, TargetMode.NETWORK_INTEGRATION) # network-integration
-def complete_network_testcase(prefix, parsed_args, **_): # type: (str, argparse.Namespace, ...) -> t.List[str]
+def complete_network_testcase(prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Return a list of test cases matching the given prefix if only one target was parsed from the command line, otherwise return an empty list."""
testcases = []
diff --git a/test/lib/ansible_test/_internal/cli/completers.py b/test/lib/ansible_test/_internal/cli/completers.py
index a4b9c04f4e..593ac8881a 100644
--- a/test/lib/ansible_test/_internal/cli/completers.py
+++ b/test/lib/ansible_test/_internal/cli/completers.py
@@ -13,14 +13,14 @@ from .argparsing.argcompletion import (
)
-def complete_target(completer, prefix, parsed_args, **_): # type: (OptionCompletionFinder, str, argparse.Namespace, ...) -> t.List[str]
+def complete_target(completer: OptionCompletionFinder, prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Perform completion for the targets configured for the command being parsed."""
matches = find_target_completion(parsed_args.targets_func, prefix, completer.list_mode)
completer.disable_completion_mangling = completer.list_mode and len(matches) > 1
return matches
-def complete_choices(choices, prefix, **_): # type: (t.List[str], str, ...) -> t.List[str]
+def complete_choices(choices: t.List[str], prefix: str, **_) -> t.List[str]:
"""Perform completion using the provided choices."""
matches = [choice for choice in choices if choice.startswith(prefix)]
return matches
diff --git a/test/lib/ansible_test/_internal/cli/environments.py b/test/lib/ansible_test/_internal/cli/environments.py
index 640ff56bd4..964793f900 100644
--- a/test/lib/ansible_test/_internal/cli/environments.py
+++ b/test/lib/ansible_test/_internal/cli/environments.py
@@ -526,24 +526,24 @@ def add_environment_remote(
)
-def complete_remote_stage(prefix, **_): # type: (str, ...) -> t.List[str]
+def complete_remote_stage(prefix: str, **_) -> t.List[str]:
"""Return a list of supported stages matching the given prefix."""
return [stage for stage in ('prod', 'dev') if stage.startswith(prefix)]
-def complete_windows(prefix, parsed_args, **_): # type: (str, argparse.Namespace, ...) -> t.List[str]
+def complete_windows(prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Return a list of supported Windows versions matching the given prefix, excluding versions already parsed from the command line."""
return [i for i in get_windows_version_choices() if i.startswith(prefix) and (not parsed_args.windows or i not in parsed_args.windows)]
-def complete_network_platform(prefix, parsed_args, **_): # type: (str, argparse.Namespace, ...) -> t.List[str]
+def complete_network_platform(prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Return a list of supported network platforms matching the given prefix, excluding platforms already parsed from the command line."""
images = sorted(filter_completion(NETWORK_COMPLETION))
return [i for i in images if i.startswith(prefix) and (not parsed_args.platform or i not in parsed_args.platform)]
-def complete_network_platform_collection(prefix, parsed_args, **_): # type: (str, argparse.Namespace, ...) -> t.List[str]
+def complete_network_platform_collection(prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Return a list of supported network platforms matching the given prefix, excluding collection platforms already parsed from the command line."""
left = prefix.split('=')[0]
images = sorted(set(image.platform for image in filter_completion(NETWORK_COMPLETION).values()))
@@ -551,7 +551,7 @@ def complete_network_platform_collection(prefix, parsed_args, **_): # type: (st
return [i + '=' for i in images if i.startswith(left) and (not parsed_args.platform_collection or i not in [x[0] for x in parsed_args.platform_collection])]
-def complete_network_platform_connection(prefix, parsed_args, **_): # type: (str, argparse.Namespace, ...) -> t.List[str]
+def complete_network_platform_connection(prefix: str, parsed_args: argparse.Namespace, **_) -> t.List[str]:
"""Return a list of supported network platforms matching the given prefix, excluding connection platforms already parsed from the command line."""
left = prefix.split('=')[0]
images = sorted(set(image.platform for image in filter_completion(NETWORK_COMPLETION).values()))
diff --git a/test/lib/ansible_test/_internal/commands/coverage/__init__.py b/test/lib/ansible_test/_internal/commands/coverage/__init__.py
index 50bc82632f..47ad7bf8b7 100644
--- a/test/lib/ansible_test/_internal/commands/coverage/__init__.py
+++ b/test/lib/ansible_test/_internal/commands/coverage/__init__.py
@@ -152,7 +152,7 @@ def enumerate_python_arcs(
modules, # type: t.Dict[str, str]
collection_search_re, # type: t.Optional[t.Pattern]
collection_sub_re, # type: t.Optional[t.Pattern]
-): # type: (...) -> t.Generator[t.Tuple[str, t.Set[t.Tuple[int, int]]]]
+): # type: (...) -> t.Generator[t.Tuple[str, t.Set[t.Tuple[int, int]]], None, None]
"""Enumerate Python code coverage arcs in the given file."""
if os.path.getsize(path) == 0:
display.warning('Empty coverage file: %s' % path, verbosity=2)
@@ -193,7 +193,7 @@ def enumerate_powershell_lines(
path, # type: str
collection_search_re, # type: t.Optional[t.Pattern]
collection_sub_re, # type: t.Optional[t.Pattern]
-): # type: (...) -> t.Generator[t.Tuple[str, t.Dict[int, int]]]
+): # type: (...) -> t.Generator[t.Tuple[str, t.Dict[int, int]], None, None]
"""Enumerate PowerShell code coverage lines in the given file."""
if os.path.getsize(path) == 0:
display.warning('Empty coverage file: %s' % path, verbosity=2)
diff --git a/test/lib/ansible_test/_internal/commands/coverage/xml.py b/test/lib/ansible_test/_internal/commands/coverage/xml.py
index ed9603c28f..8a90f4a286 100644
--- a/test/lib/ansible_test/_internal/commands/coverage/xml.py
+++ b/test/lib/ansible_test/_internal/commands/coverage/xml.py
@@ -131,7 +131,7 @@ def _generate_powershell_xml(coverage_file): # type: (str) -> Element
return elem_coverage
-def _add_cobertura_package(packages, package_name, package_data): # type: (SubElement, str, t.Dict[str, t.Dict[str, int]]) -> t.Tuple[int, int]
+def _add_cobertura_package(packages, package_name, package_data): # type: (Element, str, t.Dict[str, t.Dict[str, int]]) -> t.Tuple[int, int]
"""Add a package element to the given packages element."""
elem_package = SubElement(packages, 'package')
elem_classes = SubElement(elem_package, 'classes')
diff --git a/test/lib/ansible_test/_internal/containers.py b/test/lib/ansible_test/_internal/containers.py
index 8ce7b052e4..1157876bc6 100644
--- a/test/lib/ansible_test/_internal/containers.py
+++ b/test/lib/ansible_test/_internal/containers.py
@@ -103,7 +103,7 @@ def run_support_container(
args, # type: EnvironmentConfig
context, # type: str
image, # type: str
- name, # type: name
+ name, # type: str
ports, # type: t.List[int]
aliases=None, # type: t.Optional[t.List[str]]
start=True, # type: bool
diff --git a/test/lib/ansible_test/_internal/docker_util.py b/test/lib/ansible_test/_internal/docker_util.py
index a92ccbd1e8..6c6f403b3e 100644
--- a/test/lib/ansible_test/_internal/docker_util.py
+++ b/test/lib/ansible_test/_internal/docker_util.py
@@ -254,7 +254,7 @@ def docker_run(
raise ApplicationError('Failed to run docker image "%s".' % image)
-def docker_start(args, container_id, options=None): # type: (EnvironmentConfig, str, t.Optional[t.List[str]]) -> (t.Optional[str], t.Optional[str])
+def docker_start(args, container_id, options=None): # type: (EnvironmentConfig, str, t.Optional[t.List[str]]) -> t.Tuple[t.Optional[str], t.Optional[str]]
"""
Start a docker container by name or ID
"""
diff --git a/test/lib/ansible_test/_internal/provider/__init__.py b/test/lib/ansible_test/_internal/provider/__init__.py
index e8972ac87c..7834614265 100644
--- a/test/lib/ansible_test/_internal/provider/__init__.py
+++ b/test/lib/ansible_test/_internal/provider/__init__.py
@@ -16,7 +16,7 @@ def get_path_provider_classes(provider_type): # type: (t.Type[TPathProvider]) -
return sorted(get_subclasses(provider_type), key=lambda c: (c.priority, c.__name__))
-def find_path_provider(provider_type, # type: t.Type[TPathProvider],
+def find_path_provider(provider_type, # type: t.Type[TPathProvider]
provider_classes, # type: t.List[t.Type[TPathProvider]]
path, # type: str
walk, # type: bool
diff --git a/test/lib/ansible_test/_internal/target.py b/test/lib/ansible_test/_internal/target.py
index ced111f784..879a7944ec 100644
--- a/test/lib/ansible_test/_internal/target.py
+++ b/test/lib/ansible_test/_internal/target.py
@@ -155,7 +155,7 @@ def walk_units_targets(): # type: () -> t.Iterable[TestTarget]
return walk_test_targets(path=data_context().content.unit_path, module_path=data_context().content.unit_module_path, extensions=('.py',), prefix='test_')
-def walk_compile_targets(include_symlinks=True): # type: (bool) -> t.Iterable[TestTarget, ...]
+def walk_compile_targets(include_symlinks=True): # type: (bool) -> t.Iterable[TestTarget]
"""Return an iterable of compile targets."""
return walk_test_targets(module_path=data_context().content.module_path, extensions=('.py',), extra_dirs=('bin',), include_symlinks=include_symlinks)