summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-30 14:16:43 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-30 14:16:43 (GMT)
commit6cccb865d1e757b1ddd5ca735cfd5fccc64d501a (patch)
tree541deca47a251aa7ba9beb841e95099a21aa0878 /Lib/test/test_pdb.py
parent4e9545783c11b62bb0f96d7a4668d4aa0918fa84 (diff)
downloadcpython-6cccb865d1e757b1ddd5ca735cfd5fccc64d501a.zip
cpython-6cccb865d1e757b1ddd5ca735cfd5fccc64d501a.tar.gz
cpython-6cccb865d1e757b1ddd5ca735cfd5fccc64d501a.tar.bz2
#7964 followup: add test case to ensure issue remains fixed.
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 1e3cecd..b248c21 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1,7 +1,10 @@
# A test suite for pdb; not very comprehensive at the moment.
import imp
+import pdb
import sys
+import unittest
+import subprocess
from test import support
# This little helper class is essential for testing pdb under doctest.
@@ -286,9 +289,30 @@ def test_pdb_run_with_code_object():
"""
+class PdbTestCase(unittest.TestCase):
+
+ def test_issue7964(self):
+ # open the file as binary so we can force \r\n newline
+ with open(support.TESTFN, 'wb') as f:
+ f.write(b'print("testing my pdb")\r\n')
+ cmd = [sys.executable, '-m', 'pdb', support.TESTFN]
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ )
+ stdout, stderr = proc.communicate(b'quit\n')
+ self.assertNotIn(b'SyntaxError', stdout,
+ "Got a syntax error running test script under PDB")
+
+ def tearDown(self):
+ support.unlink(support.TESTFN)
+
+
def test_main():
from test import test_pdb
support.run_doctest(test_pdb, verbosity=True)
+ support.run_unittest(PdbTestCase)
if __name__ == '__main__':