bpo-43864: Silence deprecation warning in test_importlib.test_module_found and test_importlib.test_module_not_found (GH-25656)

This commit is contained in:
Shreyan Avigyan 2021-04-27 21:26:08 +05:30 committed by GitHub
parent 99fdd78200
commit e3bf179642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,14 +92,18 @@ class WindowsRegistryFinderTests:
def test_module_found(self):
with setup_module(self.machinery, self.test_module):
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNot(loader, None)
self.assertIsNot(spec, None)
def test_module_not_found(self):
with setup_module(self.machinery, self.test_module, path="."):
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
loader = self.machinery.WindowsRegistryFinder.find_module(self.test_module)
spec = self.machinery.WindowsRegistryFinder.find_spec(self.test_module)
self.assertIsNone(loader)
self.assertIsNone(spec)