aps-agent/aps/tests/test_package.py

36 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""B0.1 冒烟:工具链与包结构可用(不测业务逻辑,业务逻辑随 B1 迁移进来)。"""
import subprocess
import sys
import pytest
def test_package_imports() -> None:
import aps
assert aps.__version__ == "0.1.0"
@pytest.mark.parametrize("name", ["api", "domain", "engines", "state", "importers", "governance"])
def test_subpackages_import(name: str) -> None:
"""每个子包都对应 B 线的一个搬迁目标,导入不了说明结构被改坏了。"""
module = __import__(f"aps.{name}", fromlist=[name])
assert module.__doc__, f"aps.{name} 缺少说明它负责什么的 docstring"
def test_platform_code_is_not_imported() -> None:
"""APS 不依赖平台代码:aps 包内不得出现对平台模块的引用(ADR-0010)。"""
result = subprocess.run(
[
sys.executable,
"-c",
"import aps, aps.api, aps.domain, aps.engines, aps.state, aps.importers, aps.governance",
],
capture_output=True,
text=True,
)
assert result.returncode == 0, result.stderr