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

Method test_pdb_interaction_capturing_simple

testing/test_debugging.py:364–386  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

362 result.stdout.fnmatch_lines(["-> import unknown"])
363
364 def test_pdb_interaction_capturing_simple(self, pytester: Pytester) -> None:
365 p1 = pytester.makepyfile(
366 """
367 import pytest
368 def test_1():
369 i = 0
370 print("hello17")
371 pytest.set_trace()
372 i == 1
373 assert 0
374 """
375 )
376 child = pytester.spawn_pytest(str(p1))
377 child.expect(r"test_1\(\)")
378 child.expect("i == 1")
379 child.expect("Pdb")
380 child.sendline("c")
381 rest = child.read().decode("utf-8")
382 assert "AssertionError" in rest
383 assert "1 failed" in rest
384 assert "def test_1" in rest
385 assert "hello17" in rest # out is captured
386 self.flush(child)
387
388 def test_pdb_set_trace_kwargs(self, pytester: Pytester) -> None:
389 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