summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/fragments/ansible-test-change-detection-fix.yml2
-rw-r--r--test/lib/ansible_test/_internal/import_analysis.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/changelogs/fragments/ansible-test-change-detection-fix.yml b/changelogs/fragments/ansible-test-change-detection-fix.yml
new file mode 100644
index 0000000000..3917afec3d
--- /dev/null
+++ b/changelogs/fragments/ansible-test-change-detection-fix.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - ansible-test now ignores empty ``*.py`` files when analyzing module_utils imports for change detection
diff --git a/test/lib/ansible_test/_internal/import_analysis.py b/test/lib/ansible_test/_internal/import_analysis.py
index d115cffa7f..b718e04a60 100644
--- a/test/lib/ansible_test/_internal/import_analysis.py
+++ b/test/lib/ansible_test/_internal/import_analysis.py
@@ -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))