mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Reorgenized test structure and added validation of inventory before deployment
This commit is contained in:
21
tests/integration/test_check_init_files.py
Normal file
21
tests/integration/test_check_init_files.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
class TestInitFiles(unittest.TestCase):
|
||||
def test_all_test_dirs_have_init(self):
|
||||
"""
|
||||
Ensure every subdirectory in the 'tests' folder (excluding '__pycache__') contains an '__init__.py' file.
|
||||
"""
|
||||
tests_root = Path(__file__).resolve().parents[2] / "tests"
|
||||
|
||||
for path in tests_root.rglob("*"):
|
||||
if path.is_dir() and "__pycache__" not in path.parts:
|
||||
init_file = path / "__init__.py"
|
||||
with self.subTest(directory=str(path.relative_to(tests_root))):
|
||||
self.assertTrue(
|
||||
init_file.exists(),
|
||||
f"Missing __init__.py in directory: {path}"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Reference in New Issue
Block a user