Fix ansible-test import analysis warning.

Fix overlooked in https://github.com/ansible/ansible/pull/68372/

(cherry picked from commit 77732ed50d)
pull/77749/head
Matt Clay 6 years ago committed by samccann
parent 970c8e63ff
commit 676f1056cb

@ -321,6 +321,11 @@ class ModuleUtilFinder(ast.NodeVisitor):
if is_subdir(self.path, data_context().content.test_path):
return # invalid imports in tests are ignored
path = get_import_path(name, True)
if os.path.exists(path) and os.path.getsize(path) == 0:
return # zero length __init__.py files are ignored during earlier processing, do not warn about them now
# Treat this error as a warning so tests can be executed as best as possible.
# This error should be detected by unit or integration tests.
display.warning('%s:%d Invalid module_utils import: %s' % (self.path, line_number, import_name))

Loading…
Cancel
Save