add a test for urllib3 using NoOpTracerProvider (#1574)

This commit is contained in:
avzis
2023-01-18 12:11:46 +02:00
committed by GitHub
parent c92ba14316
commit e23dd5c25a

View File

@ -330,3 +330,12 @@ class TestURLLib3Instrumentor(TestBase):
self.assertIn("request_hook_body", span.attributes)
self.assertEqual(span.attributes["request_hook_body"], body)
def test_no_op_tracer_provider(self):
URLLib3Instrumentor().uninstrument()
tracer_provider = trace.NoOpTracerProvider()
URLLib3Instrumentor().instrument(tracer_provider=tracer_provider)
response = self.perform_request(self.HTTP_URL)
self.assertEqual(b"Hello!", response.data)
self.assert_span(num_spans=0)