summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_contextlib.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2013-10-26 06:37:47 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2013-10-26 06:37:47 (GMT)
commit0ddaed345615e48b5910f17ff70bd5ce74cd1e5f (patch)
tree281878ca664bd08e09c9f93f4d450a5a4f0efe65 /Lib/test/test_contextlib.py
parent7bad39f1749a0fe1d916e9870c0ce5efe9bec690 (diff)
downloadcpython-0ddaed345615e48b5910f17ff70bd5ce74cd1e5f.zip
cpython-0ddaed345615e48b5910f17ff70bd5ce74cd1e5f.tar.gz
cpython-0ddaed345615e48b5910f17ff70bd5ce74cd1e5f.tar.bz2
Close #19396: make test_contextlib tolerate -S
Diffstat (limited to 'Lib/test/test_contextlib.py')
-rw-r--r--Lib/test/test_contextlib.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index e8d504d..419104d 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()