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

index 253fcaf36c8fc5a2116c42ba93ba8e5018557a49..d28b0425e51d8946ecbc380c7ae4aea2c9b50fe7 100644 (file)
@@ -601,6 +601,7 @@ class PdbTestCase(unittest.TestCase):
         filename = 'main.py'
         with open(filename, 'w') as f:
             f.write(textwrap.dedent(script))
+        self.addCleanup(support.unlink, filename)
         cmd = [sys.executable, '-m', 'pdb', filename]
         stdout = stderr = None
         with subprocess.Popen(cmd, stdout=subprocess.PIPE,
@@ -657,9 +658,11 @@ class PdbTestCase(unittest.TestCase):
         """
         with open('bar.py', 'w') as f:
             f.write(textwrap.dedent(bar))
+        self.addCleanup(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')
 
     def tearDown(self):
         support.unlink(support.TESTFN)