From: Nick Coghlan Date: Sat, 26 Oct 2013 06:37:47 +0000 (+1000) Subject: Close #19396: make test_contextlib tolerate -S X-Git-Tag: v3.4.0b1~531 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ddaed345615e48b5910f17ff70bd5ce74cd1e5f;p=thirdparty%2FPython%2Fcpython.git Close #19396: make test_contextlib tolerate -S --- diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index e8d504d6e5ab..419104ddb0b9 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -636,10 +636,11 @@ class TestRedirectStdout(unittest.TestCase): def test_redirect_to_string_io(self): f = io.StringIO() + msg = "Consider an API like help(), which prints directly to stdout" with redirect_stdout(f): - help(pow) - s = f.getvalue() - self.assertIn('pow', s) + print(msg) + s = f.getvalue().strip() + self.assertEqual(s, msg) def test_enter_result_is_target(self): f = io.StringIO()