[Python-checkins] r75486 - python/trunk/Lib/test/test_support.py

nick.coghlan python-checkins at python.org
Sun Oct 18 12:29:10 CEST 2009


Author: nick.coghlan
Date: Sun Oct 18 12:29:10 2009
New Revision: 75486

Log:
Silence a deprecation warning by using the appropriate replacement construct

Modified:
   python/trunk/Lib/test/test_support.py

Modified: python/trunk/Lib/test/test_support.py
==============================================================================
--- python/trunk/Lib/test/test_support.py	(original)
+++ python/trunk/Lib/test/test_support.py	Sun Oct 18 12:29:10 2009
@@ -630,13 +630,15 @@
                 raise ResourceDenied("an optional resource is not available")
 
 
+ at 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


More information about the Python-checkins mailing list