Fix ansible-test module_utils import analysis.

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.
This commit is contained in:
Matt Clay 2020-03-20 09:20:46 -07:00 committed by Matt Martz
parent 707eea3afa
commit 10fe54de58
2 changed files with 4 additions and 2 deletions

View file

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

View file

@ -148,10 +148,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))