]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Silence find_module() DeprecationWarning on Windows tests (GH-25563)
authorBrett Cannon <brett@python.org>
Fri, 23 Apr 2021 21:40:18 +0000 (14:40 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 21:40:18 +0000 (14:40 -0700)
Lib/test/test_importlib/test_windows.py

index 802fb34d8199b0afad1a5331f8bf5fc14fe841d5..b24383618c81f2f8da24aea140a879517a16d1b6 100644 (file)
@@ -5,6 +5,7 @@ import os
 import re
 import sys
 import unittest
+import warnings
 from test import support
 from test.support import import_helper
 from contextlib import contextmanager
@@ -84,7 +85,9 @@ class WindowsRegistryFinderTests:
         self.assertIs(spec, None)
 
     def test_find_module_missing(self):
-        loader = self.machinery.WindowsRegistryFinder.find_module('spam')
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            loader = self.machinery.WindowsRegistryFinder.find_module('spam')
         self.assertIs(loader, None)
 
     def test_module_found(self):