[Python-checkins] Silence find_module() DeprecationWarning on Windows tests (GH-25563)
brettcannon
webhook-mailer at python.org
Fri Apr 23 17:40:30 EDT 2021
https://github.com/python/cpython/commit/22556d84bca68a16e030e2337dcad80069d06f6b
commit: 22556d84bca68a16e030e2337dcad80069d06f6b
branch: master
author: Brett Cannon <brett at python.org>
committer: brettcannon <brett at python.org>
date: 2021年04月23日T14:40:18-07:00
summary:
Silence find_module() DeprecationWarning on Windows tests (GH-25563)
files:
M Lib/test/test_importlib/test_windows.py
diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
index 802fb34d8199b0..b24383618c81f2 100644
--- a/Lib/test/test_importlib/test_windows.py
+++ b/Lib/test/test_importlib/test_windows.py
@@ -5,6 +5,7 @@
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 @@ def test_find_spec_missing(self):
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):
More information about the Python-checkins
mailing list