summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 5635d17..a3d2dda 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -10,6 +10,7 @@ import unittest
import subprocess
import textwrap
import linecache
+import zipapp
from contextlib import ExitStack, redirect_stdout
from io import StringIO
@@ -3532,6 +3533,30 @@ def bœr():
if filename.endswith(".py"):
self._run_pdb([os.path.join(script_dir, filename)], 'q')
+ def test_zipapp(self):
+ with os_helper.temp_dir() as temp_dir:
+ os.mkdir(os.path.join(temp_dir, 'source'))
+ script = textwrap.dedent(
+ """
+ def f(x):
+ return x + 1
+ f(21 + 21)
+ """
+ )
+ with open(os.path.join(temp_dir, 'source', '__main__.py'), 'w') as f:
+ f.write(script)
+ zipapp.create_archive(os.path.join(temp_dir, 'source'),
+ os.path.join(temp_dir, 'zipapp.pyz'))
+ stdout, _ = self._run_pdb([os.path.join(temp_dir, 'zipapp.pyz')], '\n'.join([
+ 'b f',
+ 'c',
+ 'p x',
+ 'q'
+ ]))
+ self.assertIn('42', stdout)
+ self.assertIn('return x + 1', stdout)
+
+
class ChecklineTests(unittest.TestCase):
def setUp(self):
linecache.clearcache() # Pdb.checkline() uses linecache.getline()