diff options
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index bdc6b89..da81422 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -591,13 +591,11 @@ class TransientResource(object): raise ResourceDenied("an optional resource is not available") -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) +# Context managers that raise 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) @contextlib.contextmanager |