diff options
author | Christian Heimes <christian@python.org> | 2016-09-11 17:54:43 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-11 17:54:43 (GMT) |
commit | 8d14abc800df6fbfdfcaa5555dd501fc4507a846 (patch) | |
tree | 927f09a9ab89a6ad66b3cc96697cc13f1b3479ae /Lib | |
parent | 02b3035bc30095d63af5c6ddd8b5ae605305b395 (diff) | |
download | cpython-8d14abc800df6fbfdfcaa5555dd501fc4507a846.zip cpython-8d14abc800df6fbfdfcaa5555dd501fc4507a846.tar.gz cpython-8d14abc800df6fbfdfcaa5555dd501fc4507a846.tar.bz2 |
Issue 28022: Catch deprecation warning in test_httplib, reported by Martin Panter
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_httplib.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 3fc02ea..c613c57 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1642,14 +1642,16 @@ class HTTPSTest(TestCase): with self.assertRaises(ssl.CertificateError): h.request('GET', '/') # Same with explicit check_hostname=True - h = client.HTTPSConnection('localhost', server.port, context=context, - check_hostname=True) + with support.check_warnings(('', DeprecationWarning)): + h = client.HTTPSConnection('localhost', server.port, + context=context, check_hostname=True) with self.assertRaises(ssl.CertificateError): h.request('GET', '/') # With check_hostname=False, the mismatching is ignored context.check_hostname = False - h = client.HTTPSConnection('localhost', server.port, context=context, - check_hostname=False) + with support.check_warnings(('', DeprecationWarning)): + h = client.HTTPSConnection('localhost', server.port, + context=context, check_hostname=False) h.request('GET', '/nonexistent') resp = h.getresponse() resp.close() @@ -1666,8 +1668,9 @@ class HTTPSTest(TestCase): h.close() # Passing check_hostname to HTTPSConnection should override the # context's setting. - h = client.HTTPSConnection('localhost', server.port, context=context, - check_hostname=True) + with support.check_warnings(('', DeprecationWarning)): + h = client.HTTPSConnection('localhost', server.port, + context=context, check_hostname=True) with self.assertRaises(ssl.CertificateError): h.request('GET', '/') |