Fixed bug where --file-log-verbose=0 still produced verbose logs.

This commit is contained in:
Ben Nguyen Tran 2024-04-28 13:57:54 -04:00
parent 6e8fa92062
commit ea6ddbc870
1 changed files with 1 additions and 1 deletions

View File

@ -847,7 +847,7 @@ class LoggingPlugin:
@hookimpl(wrapper=True) @hookimpl(wrapper=True)
def pytest_runtest_setup(self, item: nodes.Item) -> Generator[None, None, None]: 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 old_log_file_formatter = self.log_file_handler.formatter
self.log_file_handler.setFormatter(logging.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)) self.log_file_handler.emit(logging.LogRecord('N/A', logging.INFO, 'N/A', 0, f"Running at {item.nodeid}", None, None))