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

Method test_pdb_print_captured_logs

testing/test_debugging.py:250–267  ·  view source on GitHub ↗
(self, pytester, showcapture: str)

Source from the content-addressed store, hash-verified

248
249 @pytest.mark.parametrize("showcapture", ["all", "no", "log"])
250 def test_pdb_print_captured_logs(self, pytester, showcapture: str) -> None:
251 p1 = pytester.makepyfile(
252 """
253 def test_1():
254 import logging
255 logging.warn("get " + "rekt")
256 assert False
257 """
258 )
259 child = pytester.spawn_pytest(f"--show-capture={showcapture} --pdb {p1}")
260 if showcapture in ("all", "log"):
261 child.expect("captured log")
262 child.expect("get rekt")
263 child.expect("Pdb")
264 child.sendeof()
265 rest = child.read().decode("utf8")
266 assert "1 failed" in rest
267 self.flush(child)
268
269 def test_pdb_print_captured_logs_nologging(self, pytester: Pytester) -> None:
270 p1 = pytester.makepyfile(

Callers

nothing calls this directly

Calls 4

flushMethod · 0.95
makepyfileMethod · 0.45
spawn_pytestMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected