File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
opentelemetry-instrumentation/tests/auto_instrumentation Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 2323 OTEL_PYTHON_DISTRO ,
2424)
2525from opentelemetry .instrumentation .version import __version__
26- from opentelemetry .util ._importlib_metadata import entry_points
26+ from opentelemetry .util ._importlib_metadata import EntryPoint , entry_points
2727
2828
2929class TestLoad (TestCase ):
@@ -329,5 +329,23 @@ def test_entry_point_dist_finder(self):
329329 entry_points (group = "opentelemetry_environment_variables" )
330330 )[0 ]
331331 self .assertTrue (entry_point )
332+ self .assertTrue (entry_point .dist )
333+
334+ # this will not hit cache
332335 entry_point_dist = entry_point_finder .dist_for (entry_point )
336+ self .assertTrue (entry_point_dist )
337+ # dist are not comparable so we are sure we are not hitting the cache
333338 self .assertEqual (entry_point .dist , entry_point_dist )
339+
340+ # this will hit cache
341+ entry_point_without_dist = EntryPoint (
342+ name = entry_point .name ,
343+ group = entry_point .group ,
344+ value = entry_point .value ,
345+ )
346+ self .assertIsNone (entry_point_without_dist .dist )
347+ new_entry_point_dist = entry_point_finder .dist_for (
348+ entry_point_without_dist
349+ )
350+ # dist are not comparable, being truthy is enough
351+ self .assertTrue (new_entry_point_dist )
You can’t perform that action at this time.
0 commit comments