mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Suppress deprecations for packages as well when using
test.test_support.import_module().
This commit is contained in:
parent
cda73a4b4e
commit
edb628f241
1 changed files with 2 additions and 1 deletions
|
@ -42,7 +42,8 @@ def import_module(name, deprecated=False):
|
||||||
available."""
|
available."""
|
||||||
with catch_warning(record=False):
|
with catch_warning(record=False):
|
||||||
if deprecated:
|
if deprecated:
|
||||||
warnings.filterwarnings("ignore", ".+ module", DeprecationWarning)
|
warnings.filterwarnings("ignore", ".+ (module|package)",
|
||||||
|
DeprecationWarning)
|
||||||
try:
|
try:
|
||||||
module = __import__(name, level=0)
|
module = __import__(name, level=0)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue