MCPcopy Create free account
hub / github.com/pytest-dev/pytest / rewrite

Method rewrite

src/_pytest/terminal.py:425–441  ·  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

423 self._tw.line(line, **markup)
424
425 def rewrite(self, line: str, **markup: bool) -> None:
426 """Rewinds the terminal cursor to the beginning and writes the given line.
427
428 :param erase:
429 If True, will also add spaces until the full terminal width to ensure
430 previous lines are properly erased.
431
432 The rest of the keyword arguments are markup instructions.
433 """
434 erase = markup.pop("erase", False)
435 if erase:
436 fill_count = self._tw.fullwidth - len(line) - 1
437 fill = " " * fill_count
438 else:
439 fill = ""
440 line = str(line)
441 self._tw.write("\r" + line + fill, **markup)
442
443 def write_sep(
444 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