Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2848e41

Browse files
orsenthilitamaro
authored andcommitted
pythongh-99352: Ensure HTTPSConnection is available before exercising https tests. (python#103828)
pythongh-99352: Ensure HTTPSConnection is available before exercising httpstests.This will fix the buildbot issue mentioned inpython#99353
1 parentdba7b35 commit2848e41

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎Lib/test/test_urllib2.py‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,16 +524,17 @@ def http_open(self, req):
524524
returnMockResponse(200,"OK",msg,"",req.get_full_url())
525525

526526

527-
classMockHTTPSHandler(urllib.request.HTTPSHandler):
528-
# Useful for testing the Proxy-Authorization request by verifying the
529-
# properties of httpcon
527+
ifhasattr(http.client,'HTTPSConnection'):
528+
classMockHTTPSHandler(urllib.request.HTTPSHandler):
529+
# Useful for testing the Proxy-Authorization request by verifying the
530+
# properties of httpcon
530531

531-
def__init__(self,debuglevel=None,context=None,check_hostname=None):
532-
super(MockHTTPSHandler,self).__init__(debuglevel,context,check_hostname)
533-
self.httpconn=MockHTTPClass()
532+
def__init__(self,debuglevel=None,context=None,check_hostname=None):
533+
super(MockHTTPSHandler,self).__init__(debuglevel,context,check_hostname)
534+
self.httpconn=MockHTTPClass()
534535

535-
defhttps_open(self,req):
536-
returnself.do_open(self.httpconn,req)
536+
defhttps_open(self,req):
537+
returnself.do_open(self.httpconn,req)
537538

538539

539540
classMockHTTPHandlerCheckAuth(urllib.request.BaseHandler):
@@ -1075,6 +1076,7 @@ def test_http_handler_local_debuglevel(self):
10751076
o.open("http://www.example.com")
10761077
self.assertEqual(h._debuglevel,5)
10771078

1079+
@unittest.skipUnless(hasattr(http.client,'HTTPSConnection'),'HTTPSConnection required for HTTPS tests.')
10781080
deftest_https_handler_global_debuglevel(self):
10791081
withmock.patch.object(http.client.HTTPSConnection,'debuglevel',7):
10801082
o=OpenerDirector()
@@ -1083,6 +1085,7 @@ def test_https_handler_global_debuglevel(self):
10831085
o.open("https://www.example.com")
10841086
self.assertEqual(h._debuglevel,7)
10851087

1088+
@unittest.skipUnless(hasattr(http.client,'HTTPSConnection'),'HTTPSConnection required for HTTPS tests.')
10861089
deftest_https_handler_local_debuglevel(self):
10871090
o=OpenerDirector()
10881091
h=MockHTTPSHandler(debuglevel=4)
@@ -1456,6 +1459,7 @@ def test_proxy_https(self):
14561459
self.assertEqual([(handlers[0],"https_open")],
14571460
[tup[0:2]fortupino.calls])
14581461

1462+
@unittest.skipUnless(hasattr(http.client,'HTTPSConnection'),'HTTPSConnection required for HTTPS tests.')
14591463
deftest_proxy_https_proxy_authorization(self):
14601464
o=OpenerDirector()
14611465
ph=urllib.request.ProxyHandler(dict(https='proxy.example.com:3128'))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp