diff --git a/opentelemetry-sdk/tests/logs/test_logger_provider_cache.py b/opentelemetry-sdk/tests/logs/test_logger_provider_cache.py index ba57838e61..524ff62448 100644 --- a/opentelemetry-sdk/tests/logs/test_logger_provider_cache.py +++ b/opentelemetry-sdk/tests/logs/test_logger_provider_cache.py @@ -27,40 +27,43 @@ class TestLoggerProviderCache(unittest.TestCase): def test_get_logger_single_handler(self): handler, logger_provider = set_up_logging_handler(level=logging.DEBUG) - + # pylint: disable=protected-access + logger_cache = logger_provider._logger_cache logger = create_logger(handler, "test_logger") # Ensure logger is lazily cached - self.assertEqual(0, len(logger_provider._logger_cache)) + self.assertEqual(0, len(logger_cache)) logger.warning("test message") - self.assertEqual(1, len(logger_provider._logger_cache)) + self.assertEqual(1, len(logger_cache)) # Ensure only one logger is cached rounds = 100 for _ in range(rounds): logger.warning("test message") - self.assertEqual(1, len(logger_provider._logger_cache)) + self.assertEqual(1, len(logger_cache)) def test_get_logger_multiple_loggers(self): handler, logger_provider = set_up_logging_handler(level=logging.DEBUG) + # pylint: disable=protected-access + logger_cache = logger_provider._logger_cache num_loggers = 10 loggers = [create_logger(handler, str(i)) for i in range(num_loggers)] # Ensure loggers are lazily cached - self.assertEqual(0, len(logger_provider._logger_cache)) + self.assertEqual(0, len(logger_cache)) for logger in loggers: logger.warning("test message") - self.assertEqual(num_loggers, len(logger_provider._logger_cache)) + self.assertEqual(num_loggers, len(logger_cache)) rounds = 100 for _ in range(rounds): for logger in loggers: logger.warning("test message") - self.assertEqual(num_loggers, len(logger_provider._logger_cache)) + self.assertEqual(num_loggers, len(logger_cache))