Skip to content

Commit de4a962

Browse files
committed
fix: add a test case
Signed-off-by: Frost Ming <[email protected]>
1 parent 3170ece commit de4a962

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_remote_pdb.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,5 +1590,17 @@ def test_attach_to_process_with_colors(self):
15901590
self.assertNotIn("while x == 1", output["client"]["stdout"])
15911591
self.assertIn("while x == 1", re.sub("\x1b[^m]*m", "", output["client"]["stdout"]))
15921592

1593+
def test_attach_to_non_existent_process(self):
1594+
with force_color(False):
1595+
result = subprocess.run([sys.executable, "-m", "pdb", "-p", "999999"], text=True, capture_output=True)
1596+
self.assertNotEqual(result.returncode, 0)
1597+
error = (
1598+
"The specified process cannot be attached to due to insufficient permissions."
1599+
if sys.platform == "darwin" else
1600+
"Cannot attach to pid 999999, please make sure that the process exists"
1601+
)
1602+
self.assertIn(error, result.stdout)
1603+
1604+
15931605
if __name__ == "__main__":
15941606
unittest.main()

0 commit comments

Comments
 (0)