bpo-38962: Fix reference leak in test_httpservers (GH-17454)

This commit is contained in:
Pablo Galindo 2019-12-04 09:29:10 +00:00 committed by Victor Stinner
parent edd5b38c13
commit 24f5cac725
1 changed files with 9 additions and 5 deletions

View File

@ -807,11 +807,15 @@ class CGIHTTPServerTestCase(BaseTestCase):
(res.read(), res.getheader('Content-type'), res.status))
def test_cgi_path_in_sub_directories(self):
try:
CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin')
res = self.request('/sub/dir/cgi-bin/file5.py')
self.assertEqual(
(b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK),
(res.read(), res.getheader('Content-type'), res.status))
finally:
CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin')
class SocketlessRequestHandler(SimpleHTTPRequestHandler):