Files
checkbot/tests/test_import_all.py
patrickandClaude Sonnet 5.5 347f55cf7c
test / pytest (3.11) (push) Canceled after 0s
test / pytest (3.13) (push) Canceled after 0s
feat: Phase 6c baseline, ack, host alarms, outage notice, send limit, privacy mode, UI link
Includes atomic migrations, per-rule reminder semantics, first-run helper script
and the note on the undecided UI chat idea.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 03:06:23 +01:00

28 lines
863 B
Python

import importlib
import pkgutil
import subprocess
import sys
from pathlib import Path
import pytest
import app
ROOT = Path(app.__file__).resolve().parent.parent
MODULES = sorted(info.name for info in pkgutil.walk_packages(app.__path__, "app."))
TOP_LEVEL = sorted({name.split(".")[1] for name in MODULES} | {"main"})
FRESH_IMPORT_TIMEOUT = 60
@pytest.mark.parametrize("name", MODULES)
def test_module_imports(name):
importlib.import_module(name)
@pytest.mark.parametrize("name", TOP_LEVEL)
def test_top_level_import_in_fresh_interpreter(name):
# Zyklen zeigen sich oft nur, wenn ein Modul als erstes importiert wird.
result = subprocess.run([sys.executable, "-c", f"import app.{name}"], cwd=ROOT, capture_output=True,
text=True, timeout=FRESH_IMPORT_TIMEOUT)
assert result.returncode == 0, result.stderr[-2000:]