fix: resolve CAD paths from task workdir
Some checks failed
ci / test (macos-latest, 3.10) (push) Has been cancelled
ci / test (macos-latest, 3.12) (push) Has been cancelled
ci / test (ubuntu-latest, 3.10) (push) Has been cancelled
ci / test (ubuntu-latest, 3.12) (push) Has been cancelled
ci / test (windows-latest, 3.10) (push) Has been cancelled
ci / test (windows-latest, 3.12) (push) Has been cancelled
ci / browser-smoke (push) Has been cancelled

This commit is contained in:
2026-07-21 17:14:19 +08:00
parent adbd476957
commit 84a591c95a
2 changed files with 49 additions and 9 deletions

View File

@@ -501,6 +501,37 @@ def test_report_empty_input_is_a_hard_failure(tmp_path: Path) -> None:
assert "all_sources_converted_and_readable" in proc.stderr
def test_inspect_resolves_relative_paths_from_invocation_directory(tmp_path: Path) -> None:
source_dir = tmp_path / "in" / "cad"
source_dir.mkdir(parents=True)
doc = ezdxf.new("R2010")
doc.modelspace().add_line((0, 0), (1000, 0), dxfattribs={"layer": "WALL"})
doc.saveas(source_dir / "plan.dxf")
proc = subprocess.run(
[
sys.executable,
str(ROOT / "scripts" / "cad_showcase.py"),
"inspect",
"--input",
"in/cad",
"--work",
"out/work",
"--output",
"out/report",
"--no-convert",
],
cwd=tmp_path,
text=True,
capture_output=True,
)
assert proc.returncode == 0, proc.stderr
report = json.loads((tmp_path / "out" / "report" / "cad_read_report.json").read_text(encoding="utf-8"))
assert report["gate"]["status"] == "PASS"
assert (tmp_path / "out" / "work" / "dxf_sanitized" / "plan.dxf").is_file()
def test_partial_report_requires_and_records_a_reason(tmp_path: Path) -> None:
proc = subprocess.run(
[