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

View File

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