Suppress deprecations for packages as well when using

test.test_support.import_module().
This commit is contained in:
Brett Cannon 2008-05-10 02:54:52 +00:00
parent cda73a4b4e
commit edb628f241
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,8 @@ def import_module(name, deprecated=False):
available."""
with catch_warning(record=False):
if deprecated:
warnings.filterwarnings("ignore", ".+ module", DeprecationWarning)
warnings.filterwarnings("ignore", ".+ (module|package)",
DeprecationWarning)
try:
module = __import__(name, level=0)
except ImportError: