diff options
| author | Gregory P. Smith <greg@krypto.org> | 2023-09-15 21:26:45 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-15 21:26:45 (GMT) |
| commit | 59073c9ab8eb8db9304f16c46086ccc525e82570 (patch) | |
| tree | 6a7cf24572fdccca84895ef8fb175b97d9a0aa67 /Lib/test/test_httpservers.py | |
| parent | 19f5effc27bc47d76b2f484a1fcb4ccdd7dc9d67 (diff) | |
| download | cpython-59073c9ab8eb8db9304f16c46086ccc525e82570.zip cpython-59073c9ab8eb8db9304f16c46086ccc525e82570.tar.gz cpython-59073c9ab8eb8db9304f16c46086ccc525e82570.tar.bz2 | |
gh-109096: Deprecate `http.server.CGIHTTPRequestHandler` (#109387)
Deprecate `http.server.CGIHTTPRequestHandler`.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_httpservers.py')
| -rw-r--r-- | Lib/test/test_httpservers.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index cfd8a10..9fa6ecf 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -699,11 +699,20 @@ print("</pre>") "This test can't be run reliably as root (issue #13308).") class CGIHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler): - pass + _test_case_self = None # populated by each setUp() method call. + + def __init__(self, *args, **kwargs): + with self._test_case_self.assertWarnsRegex( + DeprecationWarning, + r'http\.server\.CGIHTTPRequestHandler'): + # This context also happens to catch and silence the + # threading DeprecationWarning from os.fork(). + super().__init__(*args, **kwargs) linesep = os.linesep.encode('ascii') def setUp(self): + self.request_handler._test_case_self = self # practical, but yuck. BaseTestCase.setUp(self) self.cwd = os.getcwd() self.parent_dir = tempfile.mkdtemp() @@ -780,6 +789,7 @@ class CGIHTTPServerTestCase(BaseTestCase): os.chdir(self.parent_dir) def tearDown(self): + self.request_handler._test_case_self = None try: os.chdir(self.cwd) if self._pythonexe_symlink: |
