Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check for HTTPSConnection.
  • Loading branch information
orsenthil committed Apr 25, 2023
commit b2f2437cafd8d9515584f3a352326e247a1d8b1f
18 changes: 9 additions & 9 deletions Lib/test/test_urllib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,17 +524,17 @@ def http_open(self, req):
return MockResponse(200, "OK", msg, "", req.get_full_url())


@unittest.skipUnless(hasattr(http.client, 'HTTPSConnection'), 'HTTPSConnection required for HTTPS tests.')
class MockHTTPSHandler(urllib.request.HTTPSHandler):
# Useful for testing the Proxy-Authorization request by verifying the
# properties of httpcon
if hasattr(http.client, 'HTTPSConnection'):
class MockHTTPSHandler(urllib.request.HTTPSHandler):
# Useful for testing the Proxy-Authorization request by verifying the
# properties of httpcon

def __init__(self, debuglevel=None, context=None, check_hostname=None):
super(MockHTTPSHandler, self).__init__(debuglevel, context, check_hostname)
self.httpconn = MockHTTPClass()
def __init__(self, debuglevel=None, context=None, check_hostname=None):
super(MockHTTPSHandler, self).__init__(debuglevel, context, check_hostname)
self.httpconn = MockHTTPClass()

def https_open(self, req):
return self.do_open(self.httpconn, req)
def https_open(self, req):
return self.do_open(self.httpconn, req)


class MockHTTPHandlerCheckAuth(urllib.request.BaseHandler):
Expand Down