bpo-40275: Use new test.support helper submodules in tests (GH-21452)

This commit is contained in:
Hai Shi 2020-08-04 23:51:43 +08:00 committed by GitHub
parent da4e09fff6
commit 604bba1f8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 54 deletions

View file

@ -8,9 +8,9 @@ import threading
import unittest
import hashlib
from test import support
from test.support import hashlib_helper
from test.support import threading_helper
from test.support import warnings_helper
try:
import ssl
@ -567,7 +567,7 @@ class TestUrlopen(unittest.TestCase):
def test_https_with_cafile(self):
handler = self.start_https_server(certfile=CERT_localhost)
with support.check_warnings(('', DeprecationWarning)):
with warnings_helper.check_warnings(('', DeprecationWarning)):
# Good cert
data = self.urlopen("https://localhost:%s/bizarre" % handler.port,
cafile=CERT_localhost)
@ -585,7 +585,7 @@ class TestUrlopen(unittest.TestCase):
def test_https_with_cadefault(self):
handler = self.start_https_server(certfile=CERT_localhost)
# Self-signed cert should fail verification with system certificate store
with support.check_warnings(('', DeprecationWarning)):
with warnings_helper.check_warnings(('', DeprecationWarning)):
with self.assertRaises(urllib.error.URLError) as cm:
self.urlopen("https://localhost:%s/bizarre" % handler.port,
cadefault=True)