From: Shreyan Avigyan Date: Tue, 27 Apr 2021 15:56:08 +0000 (+0530) Subject: bpo-43864: Silence deprecation warning in test_importlib.test_module_found and test_i... X-Git-Tag: v3.10.0b1~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3bf179642a3445fb079454f382b93d0177f5012;p=thirdparty%2FPython%2Fcpython.git bpo-43864: Silence deprecation warning in test_importlib.test_module_found and test_importlib.test_module_not_found (GH-25656) --- diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py index b24383618c81..6f09c5a7a5a4 100644 --- a/Lib/test/test_importlib/test_windows.py +++ b/Lib/test/test_importlib/test_windows.py @@ -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)