fix: 清除硬编码API Key与机器特定路径,改用环境变量+混合式路径解析
This commit is contained in:
@@ -8,6 +8,7 @@ from pathlib import Path
|
||||
from playwright.sync_api import Page, expect, sync_playwright
|
||||
|
||||
BASE_URL = "http://127.0.0.1:8000"
|
||||
COBOL_GIT = Path(os.environ.get("COBOL_GIT_ROOT", Path(__file__).resolve().parent.parent.parent / "jcl-cobol-git"))
|
||||
FIXTURES = Path(__file__).parent / "fixtures"
|
||||
TESTS_DIR = Path(__file__).parent
|
||||
|
||||
@@ -172,7 +173,7 @@ def test_file_size_limit(page: Page):
|
||||
@pytest.mark.skipif(not _cobol_available(), reason="WSL not available")
|
||||
def test_cobol_system_pipeline_exists(page: Page):
|
||||
"""TC-E2E-02 prep: Verify COBOL system data files exist."""
|
||||
data_dir = Path(r"D:\cobol-java\jcl-cobol-git\data")
|
||||
data_dir = COBOL_GIT / "data"
|
||||
assert (data_dir / "input/member.dat").exists(), "member.dat missing"
|
||||
assert (data_dir / "input/rate.dat").exists(), "rate.dat missing"
|
||||
assert (data_dir / "output/summary_report.dat").exists(), "summary_report missing"
|
||||
@@ -181,7 +182,7 @@ def test_cobol_system_pipeline_exists(page: Page):
|
||||
@pytest.mark.skipif(not _cobol_available(), reason="WSL not available")
|
||||
def test_cobol_output_consistent(page: Page):
|
||||
"""TC-E2E-02: CRDVAL output matches known golden data."""
|
||||
output = Path(r"D:\cobol-java\jcl-cobol-git\data\output")
|
||||
output = COBOL_GIT / "data" / "output"
|
||||
|
||||
# Verify error report has 7+ error types
|
||||
errors = (output / "error_report.dat").read_text()
|
||||
@@ -200,8 +201,8 @@ def test_cobol_output_consistent(page: Page):
|
||||
@pytest.mark.skipif(not _cobol_available(), reason="WSL not available")
|
||||
def test_java_output_equals_cobol(page: Page):
|
||||
"""TC-E2E-02: Java CRDVAL output matches COBOL."""
|
||||
cobol_dir = Path(r"D:\cobol-java\jcl-cobol-git\data\output")
|
||||
java_dir = Path(r"D:\cobol-java\jcl-cobol-git\data\output")
|
||||
cobol_dir = COBOL_GIT / "data" / "output"
|
||||
java_dir = COBOL_GIT / "data" / "output"
|
||||
|
||||
cobol_report = cobol_dir / "error_report.dat"
|
||||
assert cobol_report.exists(), "COBOL error report missing"
|
||||
@@ -218,7 +219,7 @@ def test_java_output_equals_cobol(page: Page):
|
||||
@pytest.mark.skipif(not _cobol_available(), reason="WSL not available")
|
||||
def test_file_format_consistency(page: Page):
|
||||
"""TC-E2E-03: COBOL LINE SEQUENTIAL → JSON → Java roundtrip works."""
|
||||
cobol_dir = Path(r"D:\cobol-java\jcl-cobol-git")
|
||||
cobol_dir = COBOL_GIT
|
||||
|
||||
# Check JSON conversion output exists
|
||||
json_file = cobol_dir / "data/work/validated_tx.json"
|
||||
|
||||
Reference in New Issue
Block a user