Issue #8574: better implementation of test.support.transient_internet().

Original patch by Victor.
This commit is contained in:
Antoine Pitrou 2010-09-07 20:42:19 +00:00
parent f015b3f5f6
commit a88c83cbab
2 changed files with 35 additions and 11 deletions

View file

@ -477,10 +477,10 @@ class NetworkedTests(unittest.TestCase):
# NOTE: https://sha256.tbs-internet.com is another possible test host
remote = ("sha2.hboeck.de", 443)
sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem")
s = ssl.wrap_socket(socket.socket(socket.AF_INET),
cert_reqs=ssl.CERT_REQUIRED,
ca_certs=sha256_cert,)
with support.transient_internet():
with support.transient_internet("sha2.hboeck.de"):
s = ssl.wrap_socket(socket.socket(socket.AF_INET),
cert_reqs=ssl.CERT_REQUIRED,
ca_certs=sha256_cert,)
try:
s.connect(remote)
if support.verbose: