MCPcopy
hub / github.com/pytest-dev/pytest / rewrite

Method rewrite

src/_pytest/terminal.py:540–556  ·  view source on GitHub ↗

Rewinds the terminal cursor to the beginning and writes the given line. :param erase: If True, will also add spaces until the full terminal width to ensure previous lines are properly erased. The rest of the keyword arguments are markup instructions.

(self, line: str, **markup: bool)

Source from the content-addressed store, hash-verified

538 self._tw.line(line, **markup)
539
540 def rewrite(self, line: str, **markup: bool) -> None:
541 """Rewinds the terminal cursor to the beginning and writes the given line.
542
543 :param erase:
544 If True, will also add spaces until the full terminal width to ensure
545 previous lines are properly erased.
546
547 The rest of the keyword arguments are markup instructions.
548 """
549 erase = markup.pop("erase", False)
550 if erase:
551 fill_count = self._tw.fullwidth - len(line) - 1
552 fill = " " * fill_count
553 else:
554 fill = ""
555 line = str(line)
556 self._tw.write("\r" + line + fill, **markup)
557
558 def write_sep(
559 self,

Callers 2

report_collectMethod · 0.95
test_rewriteMethod · 0.95

Calls 2

popMethod · 0.80
writeMethod · 0.45

Tested by 1

test_rewriteMethod · 0.76