test_tools: catch stderr (GH-7404)

Hide "recursedown('@test_9296_tmp')" message.
This commit is contained in:
Victor Stinner 2018-06-04 22:26:21 +02:00 committed by GitHub
parent a30d587eb5
commit fadcd4458d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View 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"):