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

Method wrap_write

src/_pytest/terminal.py:503–523  ·  view source on GitHub ↗

Wrap message with margin for progress info.

(
        self,
        content: str,
        *,
        flush: bool = False,
        margin: int = 8,
        line_sep: str = "\n",
        **markup: bool,
    )

Source from the content-addressed store, hash-verified

501 self.currentfspath = None
502
503 def wrap_write(
504 self,
505 content: str,
506 *,
507 flush: bool = False,
508 margin: int = 8,
509 line_sep: str = "\n",
510 **markup: bool,
511 ) -> None:
512 """Wrap message with margin for progress info."""
513 width_of_current_line = self._tw.width_of_current_line
514 wrapped = line_sep.join(
515 textwrap.wrap(
516 " " * width_of_current_line + content,
517 width=self._screen_width - margin,
518 drop_whitespace=True,
519 replace_whitespace=False,
520 ),
521 )
522 wrapped = wrapped[width_of_current_line:]
523 self._tw.write(wrapped, flush=flush, **markup)
524
525 def write(self, content: str, *, flush: bool = False, **markup: bool) -> None:
526 self._tw.write(content, flush=flush, **markup)

Callers 1

Calls 3

joinMethod · 0.80
wrapMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected