Skip to content

Commit

Permalink
Add more symbols to opentelemetry.util._importlib_metadata (#4181)
Browse files Browse the repository at this point in the history
Fixes #4180
  • Loading branch information
ocelotl authored Sep 11, 2024
1 parent bd51fcb commit a8aacb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
20 changes: 14 additions & 6 deletions opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@
# FIXME: Use importlib.metadata when support for 3.11 is dropped if the rest of
# the supported versions at that time have the same API.
from importlib_metadata import ( # type: ignore
Distribution,
EntryPoint,
EntryPoints,
PackageNotFoundError,
distributions,
entry_points,
requires,
version,
)

# The importlib-metadata library has introduced breaking changes before to its
# API, this module is kept just to act as a layer between the
# importlib-metadata library and our project if in any case it is necessary to
# do so.

__all__ = ["entry_points", "version", "EntryPoint", "EntryPoints"]
__all__ = [
"entry_points",
"version",
"EntryPoint",
"EntryPoints",
"requires",
"Distribution",
"distributions",
"PackageNotFoundError",
]
3 changes: 3 additions & 0 deletions opentelemetry-api/tests/util/test__importlib_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from opentelemetry.util._importlib_metadata import (
entry_points as importlib_metadata_entry_points,
)
from opentelemetry.util._importlib_metadata import version


class TestEntryPoints(TestCase):
Expand Down Expand Up @@ -106,3 +107,5 @@ def test_uniform_behavior(self):
entry_points = importlib_metadata_entry_points(group="abc", name="abc")
self.assertIsInstance(entry_points, EntryPoints)
self.assertEqual(len(entry_points), 0)

self.assertIsInstance(version("opentelemetry-api"), str)

0 comments on commit a8aacb0

Please sign in to comment.