gh-76007: Deprecate __version__ attribute in http.server (#142658)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
This commit is contained in:
Hugo van Kemenade 2025-12-13 17:32:13 +02:00 committed by GitHub
parent e02a35c365
commit 170dac291e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 5 deletions

View file

@ -1560,6 +1560,16 @@ def test_https_client(self):
self.assertEqual(res, self.served_data)
class TestModule(unittest.TestCase):
def test_deprecated__version__(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'__version__' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(http.server, "__version__")
self.assertEqual(cm.filename, __file__)
def setUpModule():
unittest.addModuleCleanup(os.chdir, os.getcwd())