Skip to content

Commit 52bbb22

Browse files
authored
[3.12] gh-109096: Silence test_httpservers fork + threads DeprecationWarning on CGI support (#109471)
[3.12] gh-109096: Silence test_httpservers fork + threads DeprecationWarning on CGI support. We're not fixing CGIHTTPRequestHandler as it is deprecated in 3.13 to go away in 3.15. This just removes noise from our test suite when warnings are rightfully enabled. If the long pre-existing fork+threading mix here ever causes anyone deadlocks as is possible, disabling the test entirely on that platform makes sense rather than attempting to fix http.server.CGIHTTPRequestHandler or refactor to not use a threaded server in the test.
1 parent e9a9052 commit 52bbb22

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_httpservers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import datetime
2727
import threading
2828
from unittest import mock
29+
import warnings
2930
from io import BytesIO, StringIO
3031

3132
import unittest
@@ -699,7 +700,11 @@ def test_html_escape_filename(self):
699700
"This test can't be run reliably as root (issue #13308).")
700701
class CGIHTTPServerTestCase(BaseTestCase):
701702
class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler):
702-
pass
703+
def run_cgi(self):
704+
# Silence the threading + fork DeprecationWarning this causes.
705+
# gh-109096: This is deprecated in 3.13 to go away in 3.15.
706+
with warnings.catch_warnings(action='ignore', category=DeprecationWarning):
707+
return super().run_cgi()
703708

704709
linesep = os.linesep.encode('ascii')
705710

0 commit comments

Comments
 (0)