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

Method test_pdb_interaction_capturing_twice

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

Source from the content-addressed store, hash-verified

530 assert "UNEXPECTED EXCEPTION" not in rest
531
532 def test_pdb_interaction_capturing_twice(self, pytester: Pytester) -> None:
533 p1 = pytester.makepyfile(
534 """
535 import pytest
536 def test_1():
537 i = 0
538 print("hello17")
539 pytest.set_trace()
540 x = 3
541 print("hello18")
542 pytest.set_trace()
543 x = 4
544 assert 0
545 """
546 )
547 child = pytester.spawn_pytest(str(p1))
548 child.expect(r"PDB set_trace \(IO-capturing turned off\)")
549 child.expect("test_1")
550 child.expect("x = 3")
551 child.expect("Pdb")
552 child.sendline("c")
553 child.expect(r"PDB continue \(IO-capturing resumed\)")
554 child.expect(r"PDB set_trace \(IO-capturing turned off\)")
555 child.expect("x = 4")
556 child.expect("Pdb")
557 child.sendline("c")
558 child.expect("_ test_1 _")
559 child.expect("def test_1")
560 rest = child.read().decode("utf8")
561 assert "Captured stdout call" in rest
562 assert "hello17" in rest # out is captured
563 assert "hello18" in rest # out is captured
564 assert "1 failed" in rest
565 self.flush(child)
566
567 def test_pdb_with_injected_do_debug(self, pytester: Pytester) -> None:
568 """Simulates pdbpp, which injects Pdb into do_debug, and uses

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