]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_tools: catch stderr (GH-7404)
authorVictor Stinner <vstinner@redhat.com>
Mon, 4 Jun 2018 20:26:21 +0000 (22:26 +0200)
committerGitHub <noreply@github.com>
Mon, 4 Jun 2018 20:26:21 +0000 (22:26 +0200)
Hide "recursedown('@test_9296_tmp')" message.

Lib/test/test_tools.py

index 57b3ef11fd5969c65b0b24a0c287c7e5fea3d323..51e4fd61c77aa0e9b4d459a65acf2bc7dda35ab1 100644 (file)
@@ -416,12 +416,15 @@ class FixcidTests(unittest.TestCase):
         with open(os.path.join(test_support.TESTFN, "file.py"), "w") as file:
             file.write("xx = 'unaltered'\n")
         script = os.path.join(scriptsdir, "fixcid.py")
-        output = self.run_script(args=(test_support.TESTFN,))
+        # ignore dbg() messages
+        with test_support.captured_stderr() as stderr:
+            output = self.run_script(args=(test_support.TESTFN,))
         self.assertMultiLineEqual(output,
             "{}:\n"
             "1\n"
             '< int xx;\n'
-            '> int yy;\n'.format(c_filename)
+            '> int yy;\n'.format(c_filename),
+            "stderr: %s" % stderr.getvalue()
         )
 
     def run_script(self, input="", args=("-",), substfile="xx yy\n"):