]> granicus.if.org Git - python/commitdiff
Close #19396: make test_contextlib tolerate -S
authorNick Coghlan <ncoghlan@gmail.com>
Sat, 26 Oct 2013 06:37:47 +0000 (16:37 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Sat, 26 Oct 2013 06:37:47 +0000 (16:37 +1000)
Lib/test/test_contextlib.py

index e8d504d6e5ab4131fcd448b61057e59d252b224a..419104ddb0b9cd25f74237260408e7266c99d9ad 100644 (file)
@@ -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()