| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- """Import and packaging smoke tests. Do not require a running daemon."""
- from __future__ import annotations
- def test_import_package():
- import hth_sdk
- assert hth_sdk.API_VERSION == "hth.api.v1"
- assert hth_sdk.__version__ == "0.1.0"
- def test_public_symbols():
- import hth_sdk
- for name in (
- "ActionBatch",
- "ActionBatchBuilder",
- "MockClient",
- "HthClient",
- "ControlLease",
- "connect",
- "DeviceEpochChanged",
- "DataGap",
- ):
- assert hasattr(hth_sdk, name)
- def test_sdk_does_not_import_heavy_deps():
- import ast
- from pathlib import Path
- import hth_sdk
- banned = {"numpy", "pandas", "torch", "tensorflow"}
- root = Path(hth_sdk.__file__).resolve().parent
- for path in root.rglob("*.py"):
- if "generated" in path.parts:
- continue
- tree = ast.parse(path.read_text(encoding="utf-8"))
- for node in ast.walk(tree):
- names: list[str] = []
- if isinstance(node, ast.Import):
- names = [n.name.split(".", 1)[0] for n in node.names]
- elif isinstance(node, ast.ImportFrom) and node.module:
- names = [node.module.split(".", 1)[0]]
- for name in names:
- assert name not in banned, f"{path} imports {name}"
|