mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-29 13:12:39 +08:00
Remove pkg resources (#2871)
This commit is contained in:

committed by
GitHub

parent
d7d7e96ce5
commit
e4ece57a81
@ -15,10 +15,9 @@
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from pkg_resources import EntryPoint
|
||||
|
||||
from opentelemetry.instrumentation.distro import BaseDistro
|
||||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
||||
from opentelemetry.util._importlib_metadata import EntryPoint
|
||||
|
||||
|
||||
class MockInstrumetor(BaseInstrumentor):
|
||||
@ -33,11 +32,13 @@ class MockInstrumetor(BaseInstrumentor):
|
||||
|
||||
|
||||
class MockEntryPoint(EntryPoint):
|
||||
def __init__(self, obj): # pylint: disable=super-init-not-called
|
||||
self._obj = obj
|
||||
def __init__(
|
||||
self, name, value, group
|
||||
): # pylint: disable=super-init-not-called
|
||||
pass
|
||||
|
||||
def load(self, *args, **kwargs): # pylint: disable=signature-differs
|
||||
return self._obj
|
||||
return MockInstrumetor
|
||||
|
||||
|
||||
class MockDistro(BaseDistro):
|
||||
@ -51,7 +52,11 @@ class TestDistro(TestCase):
|
||||
distro = MockDistro()
|
||||
|
||||
instrumentor = MockInstrumetor()
|
||||
entry_point = MockEntryPoint(MockInstrumetor)
|
||||
entry_point = MockEntryPoint(
|
||||
"MockInstrumetor",
|
||||
value="opentelemetry",
|
||||
group="opentelemetry_distro",
|
||||
)
|
||||
|
||||
self.assertFalse(instrumentor._is_instrumented_by_opentelemetry)
|
||||
distro.load_instrumentor(entry_point)
|
||||
|
Reference in New Issue
Block a user