[Python-checkins] test_tools: catch stderr (GH-7404)
Victor Stinner
webhook-mailer at python.org
Mon Jun 4 16:26:24 EDT 2018
https://github.com/python/cpython/commit/fadcd4458dca4e9edaa35e3becb4109042944b07
commit: fadcd4458dca4e9edaa35e3becb4109042944b07
branch: 2.7
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-06-04T22:26:21+02:00
summary:
test_tools: catch stderr (GH-7404)
Hide "recursedown('@test_9296_tmp')" message.
files:
M Lib/test/test_tools.py
diff --git a/Lib/test/test_tools.py b/Lib/test/test_tools.py
index 57b3ef11fd59..51e4fd61c77a 100644
--- a/Lib/test/test_tools.py
+++ b/Lib/test/test_tools.py
@@ -416,12 +416,15 @@ def test_directory(self):
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"):
More information about the Python-checkins
mailing list