diff options
| author | Gregory P. Smith <greg@krypto.org> | 2023-09-17 20:49:42 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-17 20:49:42 (GMT) |
| commit | 52bbb224bace65ec5eead5bdf34301ff0eec96de (patch) | |
| tree | d9c332197ea22c23fa5678388ed2ac4003c5fa5d /Lib/test/test_httpservers.py | |
| parent | e9a90523c97c3c7f1937187e2ae24878227c3dd0 (diff) | |
| download | cpython-52bbb224bace65ec5eead5bdf34301ff0eec96de.zip cpython-52bbb224bace65ec5eead5bdf34301ff0eec96de.tar.gz cpython-52bbb224bace65ec5eead5bdf34301ff0eec96de.tar.bz2 | |
[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.
Diffstat (limited to 'Lib/test/test_httpservers.py')
| -rw-r--r-- | Lib/test/test_httpservers.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index cfd8a10..15f9447 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -26,6 +26,7 @@ import time import datetime import threading from unittest import mock +import warnings from io import BytesIO, StringIO import unittest @@ -699,7 +700,11 @@ print("</pre>") "This test can't be run reliably as root (issue #13308).") class CGIHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler): - pass + def run_cgi(self): + # Silence the threading + fork DeprecationWarning this causes. + # gh-109096: This is deprecated in 3.13 to go away in 3.15. + with warnings.catch_warnings(action='ignore', category=DeprecationWarning): + return super().run_cgi() linesep = os.linesep.encode('ascii') |
