Skip to content

Commit

Permalink
suppress unecessary test messages from logs benchmark
Browse files Browse the repository at this point in the history
Signed-off-by: emdneto <[email protected]>
  • Loading branch information
emdneto committed Oct 30, 2024
1 parent 966750a commit aa593fb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def _create_logger(handler, name):


@pytest.mark.parametrize("num_loggers", [1, 10, 100, 1000])
def test_simple_get_logger_different_names(benchmark, num_loggers):
def test_simple_get_logger_different_names(benchmark, num_loggers, caplog):
handler = _set_up_logging_handler(level=logging.DEBUG)
loggers = [
_create_logger(handler, str(f"logger_{i}")) for i in range(num_loggers)
]

def benchmark_get_logger():
for index in range(1000):
loggers[index % num_loggers].warning("test message")
with caplog.at_level(logging.ERROR):
for index in range(1000):
loggers[index % num_loggers].warning("test message")

benchmark(benchmark_get_logger)

0 comments on commit aa593fb

Please sign in to comment.