mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture exceptions raised when the Internet connection is flaky. Initially using in test_socket_ssl but should probably be expanded to cover any test that should not raise the captured exceptions if the Internet connection works.
This commit is contained in:
parent
192cd567bd
commit
41d4e32353
2 changed files with 14 additions and 3 deletions
|
@ -27,7 +27,7 @@ def test_basic():
|
|||
print "didn't raise TypeError"
|
||||
socket.RAND_add("this is a random string", 75.0)
|
||||
|
||||
with test_support.TransientResource(IOError, errno=errno.ETIMEDOUT):
|
||||
with test_support.transient_internet():
|
||||
f = urllib.urlopen('https://sf.net')
|
||||
buf = f.read()
|
||||
f.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue