fix: 清除硬编码API Key与机器特定路径,改用环境变量+混合式路径解析

This commit is contained in:
hangshuo652
2026-08-25 21:53:18 +08:00
parent b3895a905e
commit 8e81f960af
32 changed files with 200 additions and 76 deletions
+13 -2
View File
@@ -7,6 +7,8 @@
"""
import sys, os
from pathlib import Path
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
from cobol_testgen.read import (
@@ -17,8 +19,17 @@ from cobol_testgen.read import (
from cobol_testgen.core import build_branch_tree
from cobol_testgen.coverage import collect_decision_points
_SRC = r'C:\Users\marye\Desktop\2026技术大赛\cobol-tna-system\src'
_CPY = r'C:\Users\marye\Desktop\2026技术大赛\cobol-tna-system\cpy'
# TNA 测试数据目录: 环境变量优先 → 大赛兄弟目录兜底(见 .env.example
_TNA = Path(os.environ.get(
"COBOL_TNA_ROOT",
Path(__file__).resolve().parent.parent.parent.parent / "cobol-tna-system",
))
_SRC = str(_TNA / "src")
_CPY = str(_TNA / "cpy")
pytestmark = pytest.mark.skipif(
not _TNA.exists(), reason=f"TNA test data not found: {_TNA} (set COBOL_TNA_ROOT)"
)
def _load(pid):