Rename _stream_logs_enabled to _log_cli_enabled and remove _stream_logs
This commit is contained in:
parent
0b71255dda
commit
ad7d63df97
|
@ -336,10 +336,9 @@ class LoggingPlugin(object):
|
|||
create a single one for the entire test session here.
|
||||
"""
|
||||
self._config = config
|
||||
self._stream_logs = None
|
||||
|
||||
# enable verbose output automatically if live logging is enabled
|
||||
if self._stream_logs_enabled() and not config.getoption('verbose'):
|
||||
if self._log_cli_enabled() and not config.getoption('verbose'):
|
||||
# sanity check: terminal reporter should not have been loaded at this point
|
||||
assert self._config.pluginmanager.get_plugin('terminalreporter') is None
|
||||
config.option.verbose = 1
|
||||
|
@ -365,11 +364,12 @@ class LoggingPlugin(object):
|
|||
# initialized during pytest_runtestloop
|
||||
self.log_cli_handler = None
|
||||
|
||||
def _stream_logs_enabled(self):
|
||||
if self._stream_logs is None:
|
||||
self._stream_logs = self._config.getoption('--log-cli-level') is not None or \
|
||||
self._config.getini('log_cli')
|
||||
return self._stream_logs
|
||||
def _log_cli_enabled(self):
|
||||
"""Return True if log_cli should be considered enabled, either explicitly
|
||||
or because --log-cli-level was given in the command-line.
|
||||
"""
|
||||
return self._config.getoption('--log-cli-level') is not None or \
|
||||
self._config.getini('log_cli')
|
||||
|
||||
@contextmanager
|
||||
def _runtest_for(self, item, when):
|
||||
|
@ -445,7 +445,7 @@ class LoggingPlugin(object):
|
|||
This must be done right before starting the loop so we can access the terminal reporter plugin.
|
||||
"""
|
||||
terminal_reporter = self._config.pluginmanager.get_plugin('terminalreporter')
|
||||
if self._stream_logs_enabled() and terminal_reporter is not None:
|
||||
if self._log_cli_enabled() and terminal_reporter is not None:
|
||||
capture_manager = self._config.pluginmanager.get_plugin('capturemanager')
|
||||
log_cli_handler = _LiveLoggingStreamHandler(terminal_reporter, capture_manager)
|
||||
log_cli_format = get_option_ini(self._config, 'log_cli_format', 'log_format')
|
||||
|
|
Loading…
Reference in New Issue