33 lines
993 B
Python
33 lines
993 B
Python
"""CLI 冒烟测试:确保 main.py 能正常导入和显示帮助。"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
|
|
def test_main_import():
|
|
"""main.py 能正常导入。"""
|
|
scripts_dir = os.path.join(os.path.dirname(__file__), "..", "scripts")
|
|
result = subprocess.run(
|
|
[sys.executable, "-c", "import main"],
|
|
cwd=scripts_dir,
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=10,
|
|
)
|
|
# 导入可能因为缺 jiangchang_skill_core 失败,但不应该有语法错误
|
|
assert result.returncode == 0 or "ModuleNotFoundError" in result.stderr
|
|
|
|
|
|
def test_version_command():
|
|
"""version 命令能正常执行。"""
|
|
scripts_dir = os.path.join(os.path.dirname(__file__), "..", "scripts")
|
|
result = subprocess.run(
|
|
[sys.executable, "main.py", "version"],
|
|
cwd=scripts_dir,
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=10,
|
|
)
|
|
assert "verify-invoice-default" in result.stdout or result.returncode != 0
|