Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3389,7 +3389,12 @@ def test_header(self):
header = 'Nobody expects... blah, blah, blah'
with ExitStack() as resources:
resources.enter_context(patch('sys.stdout', stdout))
# patch pdb.Pdb.set_trace() to avoid entering the debugger
resources.enter_context(patch.object(pdb.Pdb, 'set_trace'))
# We need to manually clear pdb.Pdb._last_pdb_instance so a
# new instance with stdout redirected could be created when
# pdb.set_trace() is called.
pdb.Pdb._last_pdb_instance = None
pdb.set_trace(header=header)
self.assertEqual(stdout.getvalue(), header + '\n')

Expand Down