import sys import os import subprocess import unittest class Tester(unittest.TestCase): def test_issue7750(self): if not os.path.sep == '\\': return # if the filename has something that resolves to a python # escape character (such as \t), it will fail test_fn = '.\\test7750.py' with open(test_fn, 'w') as f: f.write('print("hello world")') cmd = [ sys.executable, '-m', 'pdb', test_fn, ] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, ) stdout, stderr = proc.communicate('q\n') self.failIf('IOError' in stdout, "pdb munged the filename") os.remove(test_fn) if __name__ == '__main__': unittest.main()