File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# A test suite for pdb; not very comprehensive at the moment.
22
33import imp
4+ import pdb
45import sys
6+ import unittest
7+ import subprocess
58
69from test import support
710# This little helper class is essential for testing pdb under doctest.
@@ -286,9 +289,30 @@ def test_pdb_run_with_code_object():
286289 """
287290
288291
292+ class PdbTestCase (unittest .TestCase ):
293+
294+ def test_issue7964 (self ):
295+ # open the file as binary so we can force \r\n newline
296+ with open (support .TESTFN , 'wb' ) as f :
297+ f .write (b'print("testing my pdb")\r \n ' )
298+ cmd = [sys .executable , '-m' , 'pdb' , support .TESTFN ]
299+ proc = subprocess .Popen (cmd ,
300+ stdout = subprocess .PIPE ,
301+ stdin = subprocess .PIPE ,
302+ stderr = subprocess .STDOUT ,
303+ )
304+ stdout , stderr = proc .communicate (b'quit\n ' )
305+ self .assertNotIn (b'SyntaxError' , stdout ,
306+ "Got a syntax error running test script under PDB" )
307+
308+ def tearDown (self ):
309+ support .unlink (support .TESTFN )
310+
311+
289312def test_main ():
290313 from test import test_pdb
291314 support .run_doctest (test_pdb , verbosity = True )
315+ support .run_unittest (PdbTestCase )
292316
293317
294318if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments