summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_concurrent_futures.py
diff options
context:
space:
mode:
authorBrian Quinlan <brian@sweetapp.com>2010-12-28 21:14:34 (GMT)
committerBrian Quinlan <brian@sweetapp.com>2010-12-28 21:14:34 (GMT)
commit251cc846f3f7c150727370f00b8062b002a9e154 (patch)
tree4339712b4531812a6763a00690e0678e76113c70 /Lib/test/test_concurrent_futures.py
parentdad532f7def9917707d9705fcd9201413e42ef75 (diff)
downloadcpython-251cc846f3f7c150727370f00b8062b002a9e154.zip
cpython-251cc846f3f7c150727370f00b8062b002a9e154.tar.gz
cpython-251cc846f3f7c150727370f00b8062b002a9e154.tar.bz2
Does not install a logging handler. Fixes issue 10626.
Diffstat (limited to 'Lib/test/test_concurrent_futures.py')
-rw-r--r--Lib/test/test_concurrent_futures.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
index 876d994..6a95a36 100644
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -24,7 +24,7 @@ if sys.platform.startswith('win'):
from concurrent import futures
from concurrent.futures._base import (
PENDING, RUNNING, CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED, Future,
- LOGGER, STDERR_HANDLER, wait)
+ LOGGER, wait)
import concurrent.futures.process
def create_future(state=PENDING, exception=None, result=None):
@@ -632,11 +632,7 @@ class FutureTests(unittest.TestCase):
self.assertTrue(was_cancelled)
def test_done_callback_raises(self):
- LOGGER.removeHandler(STDERR_HANDLER)
- logging_stream = io.StringIO()
- handler = logging.StreamHandler(logging_stream)
- LOGGER.addHandler(handler)
- try:
+ with test.support.captured_stderr() as stderr:
raising_was_called = False
fn_was_called = False
@@ -655,10 +651,7 @@ class FutureTests(unittest.TestCase):
f.set_result(5)
self.assertTrue(raising_was_called)
self.assertTrue(fn_was_called)
- self.assertIn('Exception: doh!', logging_stream.getvalue())
- finally:
- LOGGER.removeHandler(handler)
- LOGGER.addHandler(STDERR_HANDLER)
+ self.assertIn('Exception: doh!', stderr.getvalue())
def test_done_callback_already_successful(self):
callback_result = None