Merge pull request #4741 from thisch/refactor_terminalreporter
Remove terminal_reporter workaround from logging.py
This commit is contained in:
commit
3a366f451a
|
@ -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.
|
||||
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")
|
||||
# if capturemanager plugin is disabled, live logging still works.
|
||||
log_cli_handler = _LiveLoggingStreamHandler(terminal_reporter, capture_manager)
|
||||
|
|
|
@ -222,12 +222,9 @@ class TerminalReporter(object):
|
|||
import _pytest.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._session = None
|
||||
self._showfspath = None
|
||||
|
||||
self.stats = {}
|
||||
self.startdir = py.path.local()
|
||||
|
@ -255,6 +252,28 @@ class TerminalReporter(object):
|
|||
return False
|
||||
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):
|
||||
char = {"xfailed": "x", "skipped": "s"}.get(char, char)
|
||||
return char in self.reportchars
|
||||
|
|
Loading…
Reference in New Issue