Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e20e47d

Browse filesBrowse files
gh-130660: Add a test for pdb when user quits after interact command (#130852)
1 parent dc6d66f commit e20e47d
Copy full SHA for e20e47d

File tree

Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed

‎Lib/test/test_pdb.py

Copy file name to clipboardExpand all lines: Lib/test/test_pdb.py
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4342,6 +4342,32 @@ def test_quit(self):
43424342
# The quit prompt should be printed exactly twice
43434343
self.assertEqual(stdout.count("Quit anyway"), 2)
43444344

4345+
def test_quit_after_interact(self):
4346+
"""
4347+
interact command will set sys.ps1 temporarily, we need to make sure
4348+
that it's restored and pdb does not believe it's in interactive mode
4349+
after interact is done.
4350+
"""
4351+
script = """
4352+
x = 1
4353+
breakpoint()
4354+
"""
4355+
4356+
commands = """
4357+
interact
4358+
quit()
4359+
q
4360+
y
4361+
"""
4362+
4363+
stdout, stderr = self._run_script(script, commands)
4364+
# Normal exit should not print anything to stderr
4365+
self.assertEqual(stderr, "")
4366+
# The quit prompt should be printed exactly once
4367+
self.assertEqual(stdout.count("Quit anyway"), 1)
4368+
# BdbQuit should not be printed
4369+
self.assertNotIn("BdbQuit", stdout)
4370+
43454371
def test_set_trace_with_skip(self):
43464372
"""GH-82897
43474373
Inline set_trace() should break unconditionally. This example is a

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.