Skip to content

Commit 4a8055f

Browse files
committed
Add some basic tests for the cache and some coverage for loading without mocks
1 parent e2db128 commit 4a8055f

File tree

1 file changed

+17
-0
lines changed
  • opentelemetry-instrumentation/tests/auto_instrumentation

1 file changed

+17
-0
lines changed

opentelemetry-instrumentation/tests/auto_instrumentation/test_load.py

+17
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
OTEL_PYTHON_DISTRO,
2424
)
2525
from opentelemetry.instrumentation.version import __version__
26+
from opentelemetry.util._importlib_metadata import entry_points
2627

2728

2829
class TestLoad(TestCase):
@@ -314,3 +315,19 @@ def test_load_instrumentors_dep_conflict(
314315
]
315316
)
316317
distro_mock.load_instrumentor.assert_called_once()
318+
319+
def test_load_instrumentors_no_entry_point_mocks(self):
320+
distro_mock = Mock()
321+
_load._load_instrumentors(distro_mock)
322+
# this has no specific assert because it is run for every instrumentation
323+
self.assertTrue(True)
324+
325+
def test_entry_point_dist_finder(self):
326+
entry_point_finder = _load._EntryPointDistFinder()
327+
self.assertTrue(entry_point_finder._mapping)
328+
entry_point = list(
329+
entry_points(group="opentelemetry_environment_variables")
330+
)[0]
331+
self.assertTrue(entry_point)
332+
entry_point_dist = entry_point_finder.dist_for(entry_point)
333+
self.assertEqual(entry_point.dist, entry_point_dist)

0 commit comments

Comments
 (0)