summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/provider/layout/collection.py
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2022-08-04 22:29:38 -0700
committerGitHub <noreply@github.com>2022-08-04 22:29:38 -0700
commit85acf4d1e55e95c266a35c49f74af3c0f251de08 (patch)
treee30d4ad68ac64f342f0c4371c1d76e8b776419b4 /test/lib/ansible_test/_internal/provider/layout/collection.py
parent5bee66fc5d2514fb2000bb8adffe84de94516964 (diff)
downloadansible-85acf4d1e55e95c266a35c49f74af3c0f251de08.tar.gz
ansible-test - Avoid use of deprecated type hints. (#78456)
* ansible-test - Avoid use of deprecated type hints. PEP 585 deprecated many container types in the `typing` module in favor of the actual types, which support subscripting as of Python 3.9. Conversion of `t.Type` was skipped since PyCharm does not currently recognize it. * ansible-test - Fix `t` and `c` imports/shadowing.
Diffstat (limited to 'test/lib/ansible_test/_internal/provider/layout/collection.py')
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/collection.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/lib/ansible_test/_internal/provider/layout/collection.py b/test/lib/ansible_test/_internal/provider/layout/collection.py
index ec4fac4e92..1ee12b5399 100644
--- a/test/lib/ansible_test/_internal/provider/layout/collection.py
+++ b/test/lib/ansible_test/_internal/provider/layout/collection.py
@@ -2,7 +2,6 @@
from __future__ import annotations
import os
-import typing as t
from . import (
ContentLayout,
@@ -26,7 +25,7 @@ class CollectionLayout(LayoutProvider):
return False
- def create(self, root: str, paths: t.List[str]) -> ContentLayout:
+ def create(self, root: str, paths: list[str]) -> ContentLayout:
"""Create a Layout using the given root and paths."""
plugin_paths = dict((p, os.path.join('plugins', p)) for p in self.PLUGIN_TYPES)
@@ -77,7 +76,7 @@ class CollectionLayout(LayoutProvider):
)
@staticmethod
- def __check_test_path(paths: t.List[str], messages: LayoutMessages) -> None:
+ def __check_test_path(paths: list[str], messages: LayoutMessages) -> None:
modern_test_path = 'tests/'
modern_test_path_found = any(path.startswith(modern_test_path) for path in paths)
legacy_test_path = 'test/'
@@ -89,7 +88,7 @@ class CollectionLayout(LayoutProvider):
messages.warning.append('Ignoring tests in "%s" that should be in "%s".' % (legacy_test_path, modern_test_path))
@staticmethod
- def __check_integration_path(paths: t.List[str], messages: LayoutMessages) -> str:
+ def __check_integration_path(paths: list[str], messages: LayoutMessages) -> str:
modern_integration_path = 'roles/test/'
modern_integration_path_found = any(path.startswith(modern_integration_path) for path in paths)
legacy_integration_path = 'tests/integration/targets/'
@@ -111,7 +110,7 @@ class CollectionLayout(LayoutProvider):
return integration_targets_path
@staticmethod
- def __check_unit_path(paths: t.List[str], messages: LayoutMessages) -> None:
+ def __check_unit_path(paths: list[str], messages: LayoutMessages) -> None:
modern_unit_path = 'tests/unit/'
modern_unit_path_found = any(path.startswith(modern_unit_path) for path in paths)
legacy_unit_path = 'tests/units/' # test/units/ will be covered by the warnings for test/ vs tests/