summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2009-10-18 10:29:10 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2009-10-18 10:29:10 (GMT)
commitf317019c079d2bb4646a1cde1785c73880b50d00 (patch)
tree0cbf4dba86d48b020967e7c794b9166b3c9a5689 /Lib
parent2b06d42db58e333ee932b5718ef2cb14b9ccfa91 (diff)
downloadcpython-f317019c079d2bb4646a1cde1785c73880b50d00.zip
cpython-f317019c079d2bb4646a1cde1785c73880b50d00.tar.gz
cpython-f317019c079d2bb4646a1cde1785c73880b50d00.tar.bz2
Silence a deprecation warning by using the appropriate replacement construct
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_support.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 048c527..d97e150 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -630,13 +630,15 @@ class TransientResource(object):
raise ResourceDenied("an optional resource is not available")
+@contextlib.contextmanager
def transient_internet():
"""Return a context manager that raises ResourceDenied when various issues
with the Internet connection manifest themselves as exceptions."""
time_out = TransientResource(IOError, errno=errno.ETIMEDOUT)
socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET)
ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET)
- return contextlib.nested(time_out, socket_peer_reset, ioerror_peer_reset)
+ with time_out, socket_peer_reset, ioerror_peer_reset:
+ yield
@contextlib.contextmanager