diff options
Diffstat (limited to 'test/lib/ansible_test/_internal/provider/__init__.py')
-rw-r--r-- | test/lib/ansible_test/_internal/provider/__init__.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/lib/ansible_test/_internal/provider/__init__.py b/test/lib/ansible_test/_internal/provider/__init__.py index 61d7baf915..9b73ae726f 100644 --- a/test/lib/ansible_test/_internal/provider/__init__.py +++ b/test/lib/ansible_test/_internal/provider/__init__.py @@ -16,11 +16,12 @@ def get_path_provider_classes(provider_type: t.Type[TPathProvider]) -> list[t.Ty return sorted(get_subclasses(provider_type), key=lambda subclass: (subclass.priority, subclass.__name__)) -def find_path_provider(provider_type: t.Type[TPathProvider], - provider_classes: list[t.Type[TPathProvider]], - path: str, - walk: bool, - ) -> TPathProvider: +def find_path_provider( + provider_type: t.Type[TPathProvider], + provider_classes: list[t.Type[TPathProvider]], + path: str, + walk: bool, +) -> TPathProvider: """Return the first found path provider of the given type for the given path.""" sequences = sorted(set(pc.sequence for pc in provider_classes if pc.sequence > 0)) @@ -48,6 +49,7 @@ def find_path_provider(provider_type: t.Type[TPathProvider], class ProviderNotFoundForPath(ApplicationError): """Exception generated when a path based provider cannot be found for a given path.""" + def __init__(self, provider_type: t.Type, path: str) -> None: super().__init__('No %s found for path: %s' % (provider_type.__name__, path)) @@ -57,6 +59,7 @@ class ProviderNotFoundForPath(ApplicationError): class PathProvider(metaclass=abc.ABCMeta): """Base class for provider plugins that are path based.""" + sequence = 500 priority = 500 |