]> granicus.if.org Git - python/commitdiff
#13183: backport fixes to test_pdb to 2.7 branch
authorGeorg Brandl <georg@python.org>
Sun, 6 May 2012 09:53:51 +0000 (11:53 +0200)
committerGeorg Brandl <georg@python.org>
Sun, 6 May 2012 09:53:51 +0000 (11:53 +0200)
Lib/test/test_pdb.py

index 5c1a37c280a33f7f9cf4021ca58ef1b7f72050ba..559f75623f4f2ed65fe83cea29b46b4bd517934e 100644 (file)
@@ -20,6 +20,7 @@ class PdbTestCase(unittest.TestCase):
         filename = 'main.py'
         with open(filename, 'w') as f:
             f.write(textwrap.dedent(script))
+        self.addCleanup(test_support.unlink, filename)
         cmd = [sys.executable, '-m', 'pdb', filename]
         stdout = stderr = None
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
@@ -61,9 +62,11 @@ class PdbTestCase(unittest.TestCase):
         """
         with open('bar.py', 'w') as f:
             f.write(textwrap.dedent(bar))
+        self.addCleanup(test_support.unlink, 'bar.py')
         stdout, stderr = self.run_pdb(script, commands)
-        self.assertIn('main.py(5)foo()->None', stdout.split('\n')[-3],
-                         'Fail to step into the caller after a return')
+        self.assertTrue(
+            any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
+            'Fail to step into the caller after a return')
 
 
 class PdbTestInput(object):