terminalwriter: remove unused property chars_on_current_line

This commit is contained in:
Ran Benita 2020-04-29 18:10:54 +03:00
parent 1bc4170e63
commit dd32c72ff0
2 changed files with 1 additions and 13 deletions

View File

@ -83,7 +83,6 @@ class TerminalWriter:
assert file is not None
self._file = file
self.hasmarkup = should_do_markup(file)
self._chars_on_current_line = 0
self._width_of_current_line = 0
self._terminal_width = None # type: Optional[int]
@ -97,11 +96,6 @@ class TerminalWriter:
def fullwidth(self, value: int) -> None:
self._terminal_width = value
@property
def chars_on_current_line(self) -> int:
"""Return the number of characters written so far in the current line."""
return self._chars_on_current_line
@property
def width_of_current_line(self) -> int:
"""Return an estimate of the width so far in the current line."""
@ -159,10 +153,8 @@ class TerminalWriter:
if msg:
current_line = msg.rsplit("\n", 1)[-1]
if "\n" in msg:
self._chars_on_current_line = len(current_line)
self._width_of_current_line = get_line_width(current_line)
else:
self._chars_on_current_line += len(current_line)
self._width_of_current_line += get_line_width(current_line)
if self.hasmarkup and kw:

View File

@ -550,11 +550,7 @@ class TerminalReporter:
@property
def _width_of_current_line(self):
"""Return the width of current line, using the superior implementation of py-1.6 when available"""
try:
return self._tw.width_of_current_line
except AttributeError:
# py < 1.6.0
return self._tw.chars_on_current_line
return self._tw.width_of_current_line
def pytest_collection(self) -> None:
if self.isatty: