diff --git a/src/_pytest/_io/terminalwriter.py b/src/_pytest/_io/terminalwriter.py index 7bd8507c2..124ffe795 100644 --- a/src/_pytest/_io/terminalwriter.py +++ b/src/_pytest/_io/terminalwriter.py @@ -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: diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index d46456733..39deaca55 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -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: