add a test for urllib using NoOpTracerProvider (#1560)

This commit is contained in:
avzis
2023-01-10 18:23:48 +02:00
committed by GitHub
parent 494bf0999c
commit d1dec9220b

View File

@ -349,6 +349,15 @@ class RequestsIntegrationTestBase(abc.ABC):
self.assertIn("response_hook_attr", span.attributes)
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):
@staticmethod