cpython: 7ff3ce0dfd45 (original) (raw)
Mercurial > cpython
changeset 102617:7ff3ce0dfd45
Issue #26741: Merge ResourceWarning fixes from 3.5 [#26741]
Martin Panter vadmium+py@gmail.com | |
---|---|
date | Fri, 12 Aug 2016 12:04:27 +0000 |
parents | 05120447f2c6(current diff)f78a682a3515(diff) |
children | 8c33152fd75c |
files | |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_httplib.py 12 Lib/test/test_poll.py 3 |
line wrap: on
line diff
--- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1402,6 +1402,7 @@ class HTTPSTest(TestCase): resp = h.getresponse() h.close() self.assertIn('nginx', resp.getheader('server'))
resp.close()[](#l1.7)
@support.system_must_validate_cert def test_networked_trusted_by_default_cert(self): @@ -1412,6 +1413,7 @@ class HTTPSTest(TestCase): h.request('GET', '/') resp = h.getresponse() content_type = resp.getheader('content-type')
resp.close()[](#l1.15) h.close()[](#l1.16) self.assertIn('text/html', content_type)[](#l1.17)
@@ -1427,6 +1429,7 @@ class HTTPSTest(TestCase): h.request('GET', '/') resp = h.getresponse() server_string = resp.getheader('server')
resp.close()[](#l1.23) h.close()[](#l1.24) self.assertIn('nginx', server_string)[](#l1.25)
@@ -1460,8 +1463,10 @@ class HTTPSTest(TestCase): context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(CERT_localhost) h = client.HTTPSConnection('localhost', server.port, context=context)
self.addCleanup(h.close)[](#l1.31) h.request('GET', '/nonexistent')[](#l1.32) resp = h.getresponse()[](#l1.33)
self.addCleanup(resp.close)[](#l1.34) self.assertEqual(resp.status, 404)[](#l1.35)
def test_local_bad_hostname(self): @@ -1486,13 +1491,18 @@ class HTTPSTest(TestCase): check_hostname=False) h.request('GET', '/nonexistent') resp = h.getresponse()
resp.close()[](#l1.42)
h.close()[](#l1.43) self.assertEqual(resp.status, 404)[](#l1.44) # The context's check_hostname setting is used if one isn't passed to[](#l1.45) # HTTPSConnection.[](#l1.46) context.check_hostname = False[](#l1.47) h = client.HTTPSConnection('localhost', server.port, context=context)[](#l1.48) h.request('GET', '/nonexistent')[](#l1.49)
self.assertEqual(h.getresponse().status, 404)[](#l1.50)
resp = h.getresponse()[](#l1.51)
self.assertEqual(resp.status, 404)[](#l1.52)
resp.close()[](#l1.53)
h.close()[](#l1.54) # Passing check_hostname to HTTPSConnection should override the[](#l1.55) # context's setting.[](#l1.56) h = client.HTTPSConnection('localhost', server.port, context=context,[](#l1.57)
--- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -125,6 +125,8 @@ class PollTests(unittest.TestCase): cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, bufsize=0)
proc.__enter__()[](#l2.7)
self.addCleanup(proc.__exit__, None, None, None)[](#l2.8) p = proc.stdout[](#l2.9) pollster = select.poll()[](#l2.10) pollster.register( p, select.POLLIN )[](#l2.11)
@@ -147,7 +149,6 @@ class PollTests(unittest.TestCase): continue else: self.fail('Unexpected return value from select.poll: %s' % fdlist)
p.close()[](#l2.16)