From ea6ddbc87074793a640015f6e8e9365e01e070e6 Mon Sep 17 00:00:00 2001 From: Ben Nguyen Tran Date: Sun, 28 Apr 2024 13:57:54 -0400 Subject: [PATCH] Fixed bug where --file-log-verbose=0 still produced verbose logs. --- src/_pytest/logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 7db4f95f2..3220a936e 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -847,7 +847,7 @@ class LoggingPlugin: @hookimpl(wrapper=True) def pytest_runtest_setup(self, item: nodes.Item) -> Generator[None, None, None]: - if self.log_file_verbose: + if self.log_file_verbose and int(self.log_file_verbose) >= 1: old_log_file_formatter = self.log_file_handler.formatter self.log_file_handler.setFormatter(logging.Formatter()) self.log_file_handler.emit(logging.LogRecord('N/A', logging.INFO, 'N/A', 0, f"Running at {item.nodeid}", None, None))