Skip to content

Commit

Permalink
Add some basic tests for the cache and some coverage for loading with…
Browse files Browse the repository at this point in the history
…out mocks
  • Loading branch information
xrmx committed Oct 17, 2024
1 parent e2db128 commit 4a8055f
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
OTEL_PYTHON_DISTRO,
)
from opentelemetry.instrumentation.version import __version__
from opentelemetry.util._importlib_metadata import entry_points


class TestLoad(TestCase):
Expand Down Expand Up @@ -314,3 +315,19 @@ def test_load_instrumentors_dep_conflict(
]
)
distro_mock.load_instrumentor.assert_called_once()

def test_load_instrumentors_no_entry_point_mocks(self):
distro_mock = Mock()
_load._load_instrumentors(distro_mock)
# this has no specific assert because it is run for every instrumentation
self.assertTrue(True)

def test_entry_point_dist_finder(self):
entry_point_finder = _load._EntryPointDistFinder()
self.assertTrue(entry_point_finder._mapping)
entry_point = list(
entry_points(group="opentelemetry_environment_variables")
)[0]
self.assertTrue(entry_point)
entry_point_dist = entry_point_finder.dist_for(entry_point)
self.assertEqual(entry_point.dist, entry_point_dist)

0 comments on commit 4a8055f

Please sign in to comment.