Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 252365b

Browse files
committed
Silence the altered state warning about threadgs when running test_httplib.
1 parent 40ccea7 commit 252365b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/test/test_httplib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,21 +506,20 @@ def test_networked_bad_cert(self):
506506
def test_local_good_hostname(self):
507507
# The (valid) cert validates the HTTP hostname
508508
import ssl
509-
from test.ssl_servers import make_https_server
510-
server = make_https_server(self, CERT_localhost)
509+
server = self.make_server(CERT_localhost)
511510
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
512511
context.verify_mode = ssl.CERT_REQUIRED
513512
context.load_verify_locations(CERT_localhost)
514513
h = client.HTTPSConnection('localhost', server.port, context=context)
515514
h.request('GET', '/nonexistent')
516515
resp = h.getresponse()
517516
self.assertEqual(resp.status, 404)
517+
del server
518518

519519
def test_local_bad_hostname(self):
520520
# The (valid) cert doesn't validate the HTTP hostname
521521
import ssl
522-
from test.ssl_servers import make_https_server
523-
server = make_https_server(self, CERT_fakehostname)
522+
server = self.make_server(CERT_fakehostname)
524523
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
525524
context.verify_mode = ssl.CERT_REQUIRED
526525
context.load_verify_locations(CERT_fakehostname)
@@ -538,6 +537,7 @@ def test_local_bad_hostname(self):
538537
h.request('GET', '/nonexistent')
539538
resp = h.getresponse()
540539
self.assertEqual(resp.status, 404)
540+
del server
541541

542542

543543
class RequestBodyTest(TestCase):

0 commit comments

Comments
 (0)