gh-121604: Make sure all deprecated items in importlib raise DeprecationWarning (#128007)

Co-authored-by: rashansmith <smith.rashan@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
Tomas R. 2025-01-15 01:48:46 +01:00 committed by GitHub
parent b52de22ac3
commit bd3baa8b1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 96 additions and 5 deletions

View file

@ -104,6 +104,12 @@ class WindowsRegistryFinderTests:
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNone(spec)
def test_raises_deprecation_warning(self):
# WindowsRegistryFinder is not meant to be instantiated, so the
# deprecation warning is raised in the 'find_spec' method instead.
with self.assertWarns(DeprecationWarning):
self.machinery.WindowsRegistryFinder.find_spec('spam')
(Frozen_WindowsRegistryFinderTests,
Source_WindowsRegistryFinderTests
) = test_util.test_both(WindowsRegistryFinderTests, machinery=machinery)