Skip to content

Commit 90779ce

Browse files
committed
Run linters
1 parent 205c378 commit 90779ce

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tools/check_pure_python_imports.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"""
99

1010
import os
11-
import sys
1211
import subprocess
13-
import importlib.util
12+
import sys
1413
from pathlib import Path
1514

15+
1616
def find_python_modules(lib_path):
1717
"""Find all Python modules in the lib directory."""
1818
modules = []
@@ -32,6 +32,7 @@ def find_python_modules(lib_path):
3232

3333
return sorted(modules)
3434

35+
3536
def test_pure_python_import(module_name, base_path):
3637
"""Test if a module can be imported with pure Python (no Django setup)."""
3738
test_script = f'''
@@ -51,13 +52,7 @@ def test_pure_python_import(module_name, base_path):
5152
del env['DJANGO_SETTINGS_MODULE']
5253

5354
try:
54-
result = subprocess.run(
55-
['python', '-c', test_script],
56-
capture_output=True,
57-
text=True,
58-
env=env,
59-
timeout=30
60-
)
55+
result = subprocess.run(['python', '-c', test_script], capture_output=True, text=True, env=env, timeout=30)
6156

6257
if result.returncode == 0 and "SUCCESS" in result.stdout:
6358
return True, None
@@ -69,6 +64,7 @@ def test_pure_python_import(module_name, base_path):
6964
except Exception as e:
7065
return False, f"Failed to run test: {e}"
7166

67+
7268
def main():
7369
"""Main function to test all modules in ansible_base/lib."""
7470
script_dir = Path(__file__).parent.parent # Go up one level since we're in tools/
@@ -146,5 +142,6 @@ def main():
146142
print(f"({len(expected_failures)} modules have expected failures due to Django dependencies)")
147143
sys.exit(0)
148144

145+
149146
if __name__ == "__main__":
150-
main()
147+
main()

0 commit comments

Comments
 (0)