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

Method test_pdb_interaction_doctest

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

Source from the content-addressed store, hash-verified

483 self.flush(child)
484
485 def test_pdb_interaction_doctest(self, pytester: Pytester) -> None:
486 p1 = pytester.makepyfile(
487 """
488 def function_1():
489 '''
490 >>> i = 0
491 >>> assert i == 1
492 '''
493 """
494 )
495 child = pytester.spawn_pytest("--doctest-modules --pdb %s" % p1)
496 child.expect("Pdb")
497
498 assert "UNEXPECTED EXCEPTION: AssertionError()" in child.before.decode("utf8")
499
500 child.sendline("'i=%i.' % i")
501 child.expect("Pdb")
502 assert "\r\n'i=0.'\r\n" in child.before.decode("utf8")
503
504 child.sendeof()
505 rest = child.read().decode("utf8")
506 assert "! _pytest.outcomes.Exit: Quitting debugger !" in rest
507 assert "BdbQuit" not in rest
508 assert "1 failed" in rest
509 self.flush(child)
510
511 def test_doctest_set_trace_quit(self, pytester: Pytester) -> None:
512 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