From: Brett Cannon Date: Fri, 23 Apr 2021 21:40:18 +0000 (-0700) Subject: Silence find_module() DeprecationWarning on Windows tests (GH-25563) X-Git-Tag: v3.10.0b1~186 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22556d84bca68a16e030e2337dcad80069d06f6b;p=thirdparty%2FPython%2Fcpython.git Silence find_module() DeprecationWarning on Windows tests (GH-25563) --- diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py index 802fb34d8199..b24383618c81 100644 --- a/Lib/test/test_importlib/test_windows.py +++ b/Lib/test/test_importlib/test_windows.py @@ -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):