From 5c83159a7563b5c8e3c49f0cfb5918549f4fabc1 Mon Sep 17 00:00:00 2001 From: Martin Hoyer Date: Mon, 22 May 2023 16:11:40 +0200 Subject: [PATCH] Opportunistically use "selectable" entry_points. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “selectable” entry points were introduced in importlib_metadata 3.6 and Python 3.10. While this could be solved by adding entry_points>=3.6 for python<3.10 as a dependency, python3-importib-metadata el8 package currently only have version 0.23. Fixes deprecation warnings. See: https://github.com/python/importlib_metadata/issues/298 --- tmt/plugins/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tmt/plugins/__init__.py b/tmt/plugins/__init__.py index b4771883e6..35c69718fd 100644 --- a/tmt/plugins/__init__.py +++ b/tmt/plugins/__init__.py @@ -115,7 +115,13 @@ def _explore_entry_point(entry_point: str, logger: Logger) -> None: logger = logger.descend() try: - for found in entry_points()[entry_point]: + eps = entry_points() + if hasattr(eps, "select"): + entry_point_group = eps.select(group=entry_point) + else: + entry_point_group = eps[entry_point] + + for found in entry_point_group: logger.debug(f"Loading plugin '{found.name}' ({found.value}).") found.load()