Remove terminal_reporter workaround from logging.py
The workaround was removed from the logging module by creating python properties for verbosity related settings in the terminalreporter. Closes: #4733
This commit is contained in:
parent
a1fcd6e445
commit
ddbea29c12
|
@ -0,0 +1,2 @@
|
||||||
|
Some verbosity related attributes of the TerminalReporter plugin are now
|
||||||
|
read only properties.
|
|
@ -435,13 +435,6 @@ class LoggingPlugin(object):
|
||||||
# terminal reporter is disabled e.g. by pytest-xdist.
|
# terminal reporter is disabled e.g. by pytest-xdist.
|
||||||
return
|
return
|
||||||
|
|
||||||
# FIXME don't set verbosity level and derived attributes of
|
|
||||||
# terminalwriter directly
|
|
||||||
terminal_reporter.verbosity = config.option.verbose
|
|
||||||
terminal_reporter.showheader = terminal_reporter.verbosity >= 0
|
|
||||||
terminal_reporter.showfspath = terminal_reporter.verbosity >= 0
|
|
||||||
terminal_reporter.showlongtestinfo = terminal_reporter.verbosity > 0
|
|
||||||
|
|
||||||
capture_manager = config.pluginmanager.get_plugin("capturemanager")
|
capture_manager = config.pluginmanager.get_plugin("capturemanager")
|
||||||
# if capturemanager plugin is disabled, live logging still works.
|
# if capturemanager plugin is disabled, live logging still works.
|
||||||
log_cli_handler = _LiveLoggingStreamHandler(terminal_reporter, capture_manager)
|
log_cli_handler = _LiveLoggingStreamHandler(terminal_reporter, capture_manager)
|
||||||
|
|
|
@ -222,12 +222,9 @@ class TerminalReporter(object):
|
||||||
import _pytest.config
|
import _pytest.config
|
||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.verbosity = self.config.option.verbose
|
|
||||||
self.showheader = self.verbosity >= 0
|
|
||||||
self.showfspath = self.verbosity >= 0
|
|
||||||
self.showlongtestinfo = self.verbosity > 0
|
|
||||||
self._numcollected = 0
|
self._numcollected = 0
|
||||||
self._session = None
|
self._session = None
|
||||||
|
self._showfspath = None
|
||||||
|
|
||||||
self.stats = {}
|
self.stats = {}
|
||||||
self.startdir = py.path.local()
|
self.startdir = py.path.local()
|
||||||
|
@ -255,6 +252,28 @@ class TerminalReporter(object):
|
||||||
return False
|
return False
|
||||||
return self.config.getini("console_output_style") in ("progress", "count")
|
return self.config.getini("console_output_style") in ("progress", "count")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def verbosity(self):
|
||||||
|
return self.config.option.verbose
|
||||||
|
|
||||||
|
@property
|
||||||
|
def showheader(self):
|
||||||
|
return self.verbosity >= 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def showfspath(self):
|
||||||
|
if self._showfspath is None:
|
||||||
|
return self.verbosity >= 0
|
||||||
|
return self._showfspath
|
||||||
|
|
||||||
|
@showfspath.setter
|
||||||
|
def showfspath(self, value):
|
||||||
|
self._showfspath = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def showlongtestinfo(self):
|
||||||
|
return self.verbosity > 0
|
||||||
|
|
||||||
def hasopt(self, char):
|
def hasopt(self, char):
|
||||||
char = {"xfailed": "x", "skipped": "s"}.get(char, char)
|
char = {"xfailed": "x", "skipped": "s"}.get(char, char)
|
||||||
return char in self.reportchars
|
return char in self.reportchars
|
||||||
|
|
Loading…
Reference in New Issue