35 lines
901 B
Python
35 lines
901 B
Python
from __future__ import annotations
|
|
|
|
import importlib
|
|
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
PKG_ROOT = REPO_ROOT / "sync_state_machine"
|
|
|
|
|
|
def _module_name(py_file: Path) -> str:
|
|
rel = py_file.relative_to(REPO_ROOT).with_suffix("")
|
|
return ".".join(rel.parts)
|
|
|
|
|
|
def test_sync_state_machine_module_import_surface() -> None:
|
|
py_files = sorted(PKG_ROOT.rglob("*.py"))
|
|
assert py_files, "No python modules found under sync_state_machine"
|
|
|
|
excluded_names = {"__main__"}
|
|
excluded_parts = {"tests", "__pycache__"}
|
|
|
|
imported = 0
|
|
for py_file in py_files:
|
|
if any(part in excluded_parts for part in py_file.parts):
|
|
continue
|
|
if py_file.stem in excluded_names:
|
|
continue
|
|
|
|
module_name = _module_name(py_file)
|
|
importlib.import_module(module_name)
|
|
imported += 1
|
|
|
|
assert imported >= 20
|