mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-28 20:52:57 +08:00
add a test for urllib using NoOpTracerProvider (#1560)
This commit is contained in:
@ -349,6 +349,15 @@ class RequestsIntegrationTestBase(abc.ABC):
|
|||||||
self.assertIn("response_hook_attr", span.attributes)
|
self.assertIn("response_hook_attr", span.attributes)
|
||||||
self.assertEqual(span.attributes["response_hook_attr"], "value")
|
self.assertEqual(span.attributes["response_hook_attr"], "value")
|
||||||
|
|
||||||
|
def test_no_op_tracer_provider(self):
|
||||||
|
URLLibInstrumentor().uninstrument()
|
||||||
|
tracer_provider = trace.NoOpTracerProvider
|
||||||
|
URLLibInstrumentor().instrument(tracer_provider=tracer_provider)
|
||||||
|
|
||||||
|
result = self.perform_request(self.URL)
|
||||||
|
self.assertEqual(result.read(), b"Hello!")
|
||||||
|
self.assert_span(num_spans=0)
|
||||||
|
|
||||||
|
|
||||||
class TestRequestsIntegration(RequestsIntegrationTestBase, TestBase):
|
class TestRequestsIntegration(RequestsIntegrationTestBase, TestBase):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user