Skip to content

Commit f4760c2

Browse files
committed
Assert that the LoggingHandler has not been setup in uninstrumented test
1 parent c748056 commit f4760c2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

instrumentation/opentelemetry-instrumentation-logging/tests/test_logging.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ def test_uninstrumented(self):
244244
self.assertFalse(hasattr(record, "otelTraceID"))
245245
self.assertFalse(hasattr(record, "otelTraceSampled"))
246246

247+
root_logger = logging.getLogger()
248+
logging_handler_instances = [
249+
handler
250+
for handler in root_logger.handlers
251+
if isinstance(handler, LoggingHandler)
252+
]
253+
self.assertEqual(logging_handler_instances, [])
254+
247255
def test_no_op_tracer_provider(self):
248256
LoggingInstrumentor().uninstrument()
249257
LoggingInstrumentor().instrument(

0 commit comments

Comments
 (0)