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

Method write_raw

src/_pytest/_io/terminalwriter.py:166–180  ·  view source on GitHub ↗
(self, msg: str, *, flush: bool = False)

Source from the content-addressed store, hash-verified

164 self.write_raw(msg, flush=flush)
165
166 def write_raw(self, msg: str, *, flush: bool = False) -> None:
167 try:
168 self._file.write(msg)
169 except UnicodeEncodeError:
170 # Some environments don't support printing general Unicode
171 # strings, due to misconfiguration or otherwise; in that case,
172 # print the string escaped to ASCII.
173 # When the Unicode situation improves we should consider
174 # letting the error propagate instead of masking it (see #7475
175 # for one brief attempt).
176 msg = msg.encode("unicode-escape").decode("ascii")
177 self._file.write(msg)
178
179 if flush:
180 self.flush()
181
182 def line(self, s: str = "", **markup: bool) -> None:
183 self.write(s, **markup)

Callers 1

writeMethod · 0.95

Calls 2

flushMethod · 0.95
writeMethod · 0.45

Tested by

no test coverage detected