Merge pull request #1486 from pypa/bugfix/1111-import-warning

Suppress warnings in importer.find_module.
This commit is contained in:
Jason R. Coombs 2018-09-16 10:22:37 -04:00 committed by GitHub
commit 935751c81a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1 @@
Suppress warnings in pkg_resources.handle_ns.

View File

@ -2094,7 +2094,12 @@ def _handle_ns(packageName, path_item):
importer = get_importer(path_item)
if importer is None:
return None
loader = importer.find_module(packageName)
# capture warnings due to #1111
with warnings.catch_warnings():
warnings.simplefilter("ignore")
loader = importer.find_module(packageName)
if loader is None:
return None
module = sys.modules.get(packageName)