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

Method test_doctest_set_trace_quit

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

Source from the content-addressed store, hash-verified

509 self.flush(child)
510
511 def test_doctest_set_trace_quit(self, pytester: Pytester) -> None:
512 p1 = pytester.makepyfile(
513 """
514 def function_1():
515 '''
516 >>> __import__('pdb').set_trace()
517 '''
518 """
519 )
520 # NOTE: does not use pytest.set_trace, but Python's patched pdb,
521 # therefore "-s" is required.
522 child = pytester.spawn_pytest("--doctest-modules --pdb -s %s" % p1)
523 child.expect("Pdb")
524 child.sendline("q")
525 rest = child.read().decode("utf8")
526
527 assert "! _pytest.outcomes.Exit: Quitting debugger !" in rest
528 assert "= no tests ran in" in rest
529 assert "BdbQuit" not in rest
530 assert "UNEXPECTED EXCEPTION" not in rest
531
532 def test_pdb_interaction_capturing_twice(self, pytester: Pytester) -> None:
533 p1 = pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

makepyfileMethod · 0.45
spawn_pytestMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected