mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #8574: better implementation of test.support.transient_internet().
Original patch by Victor.
This commit is contained in:
parent
f015b3f5f6
commit
a88c83cbab
2 changed files with 35 additions and 11 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue