Fix ansible-test module_utils import analysis. (#69406)

Now empty `*.py` files are ignored during module_utils import analysis for change detection.
This eliminates "No imports found" warnings for files which should have no imports.

(cherry picked from commit ab27680318)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/69999/head
Felix Fontein 5 years ago committed by GitHub
parent c43b03abe9
commit b8808efd26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now ignores empty ``*.py`` files when analyzing module_utils imports for change detection

@ -144,10 +144,10 @@ def enumerate_module_utils():
for path in data_context().content.walk_files(data_context().content.module_utils_path):
ext = os.path.splitext(path)[1]
if path == os.path.join(data_context().content.module_utils_path, '__init__.py'):
if ext != '.py':
continue
if ext != '.py':
if os.path.getsize(path) == 0:
continue
module_utils.append(get_python_module_utils_name(path))

Loading…
Cancel
Save