diff options
author | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2023-01-09 05:23:51 +0100 |
---|---|---|
committer | Sviatoslav Sydorenko <wk@sydorenko.org.ua> | 2023-01-09 05:23:51 +0100 |
commit | c9362b1493b4169b4df82d8ed1a59ef524fadb1d (patch) | |
tree | eb06542ca63dd86d3a0f5adeb6050d36baec4d79 | |
parent | 97ae5b72c51ba6be6cd0b3b378e0375eaeba6eec (diff) | |
download | cherrypy-git-c9362b1493b4169b4df82d8ed1a59ef524fadb1d.tar.gz |
🐛 Close unreleased HTTP connections @ tests
-rw-r--r-- | cherrypy/test/test_http.py | 15 | ||||
-rw-r--r-- | cherrypy/test/test_iterator.py | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cherrypy/test/test_http.py b/cherrypy/test/test_http.py index a955be43..9a7e9331 100644 --- a/cherrypy/test/test_http.py +++ b/cherrypy/test/test_http.py @@ -136,6 +136,9 @@ class HTTPTests(helper.CPWebCase): self.assertStatus(200) self.assertBody(b'Hello world!') + response.close() + c.close() + # Now send a message that has no Content-Length, but does send a body. # Verify that CP times out the socket and responds # with 411 Length Required. @@ -159,6 +162,9 @@ class HTTPTests(helper.CPWebCase): self.status = str(response.status) self.assertStatus(411) + response.close() + c.close() + def test_post_multipart(self): alphabet = 'abcdefghijklmnopqrstuvwxyz' # generate file contents for a large post @@ -184,6 +190,9 @@ class HTTPTests(helper.CPWebCase): parts = ['%s * 65536' % ch for ch in alphabet] self.assertBody(', '.join(parts)) + response.close() + c.close() + def test_post_filename_with_special_characters(self): """Testing that we can handle filenames with special characters. @@ -217,6 +226,9 @@ class HTTPTests(helper.CPWebCase): self.assertStatus(200) self.assertBody(fname) + response.close() + c.close() + def test_malformed_request_line(self): if getattr(cherrypy.server, 'using_apache', False): return self.skip('skipped due to known Apache differences...') @@ -264,6 +276,9 @@ class HTTPTests(helper.CPWebCase): self.body = response.fp.read(20) self.assertBody('Illegal header line.') + response.close() + c.close() + def test_http_over_https(self): if self.scheme != 'https': return self.skip('skipped (not running HTTPS)... ') diff --git a/cherrypy/test/test_iterator.py b/cherrypy/test/test_iterator.py index 6600a78d..5bad59be 100644 --- a/cherrypy/test/test_iterator.py +++ b/cherrypy/test/test_iterator.py @@ -150,6 +150,8 @@ class IteratorTest(helper.CPWebCase): self.assertStatus(200) self.assertBody('0') + itr_conn.close() + # Now we do the same check with streaming - some classes will # be automatically closed, while others cannot. stream_counts = {} |