diff --git a/paperforge/plugin/tests/runtime.test.mjs b/paperforge/plugin/tests/runtime.test.mjs index 0dc1da78..ae28ec92 100644 --- a/paperforge/plugin/tests/runtime.test.mjs +++ b/paperforge/plugin/tests/runtime.test.mjs @@ -36,7 +36,7 @@ describe('resolvePythonExecutable', () => { }); it('returns venv path when .venv/Scripts/python.exe exists', () => { - const d = mockDeps((p) => p.includes('.venv\\Scripts\\python.exe')); + const d = mockDeps((p) => p.includes('.venv') && p.includes('python.exe')); const r = resolvePythonExecutable('/vault', {}, d.fs, d.execFileSync); expect(r.path).toContain('.venv'); expect(r.source).toBe('auto-detected'); diff --git a/tests/test_e2e_cli.py b/tests/test_e2e_cli.py index 7fb1f4b9..20a13f5c 100644 --- a/tests/test_e2e_cli.py +++ b/tests/test_e2e_cli.py @@ -98,7 +98,10 @@ class TestCliDoctor: def test_doctor_outputs_verdict(self, test_vault: Path) -> None: """Doctor output contains [OK], [WARN], or [FAIL] verdict.""" result = _run(["doctor"], test_vault) - assert any(tag in result.stdout for tag in ["[OK]", "[WARN]", "[FAIL]"]) + stdout = result.stdout or "" + assert any(tag in stdout for tag in ["[OK]", "[WARN]", "[FAIL]"]), ( + f"No verdict in doctor output. stdout={stdout[:200]} stderr={(result.stderr or '')[:200]}" + ) class TestCliDeepReading: diff --git a/tests/test_ocr_preflight.py b/tests/test_ocr_preflight.py index 181b1f02..81d2761d 100644 --- a/tests/test_ocr_preflight.py +++ b/tests/test_ocr_preflight.py @@ -66,7 +66,7 @@ class TestOcrPreflight: ), patch( "paperforge.worker.ocr.ensure_ocr_meta", - return_value={}, + return_value={"needs_sanitize": True}, ), patch("paperforge.worker.ocr.write_json") as mock_write, patch("paperforge.worker.sync.run_selection_sync"), @@ -124,7 +124,7 @@ class TestOcrPreflight: ), patch( "paperforge.worker.ocr.ensure_ocr_meta", - return_value={}, + return_value={"needs_sanitize": True}, ), patch("paperforge.worker.ocr.write_json") as mock_write, patch("paperforge.worker.sync.run_selection_sync"), @@ -184,10 +184,10 @@ class TestOcrPreflight: ), patch( "paperforge.worker.ocr.ensure_ocr_meta", - return_value={}, + return_value={"needs_sanitize": True}, ), patch("paperforge.worker.ocr.write_json"), - patch("builtins.open") as mock_open, + patch("paperforge.worker.ocr.fitz.open") as mock_open, patch("paperforge.worker.ocr.requests.post") as mock_post, patch("paperforge.worker.ocr.requests.get") as mock_get, ): @@ -257,10 +257,10 @@ class TestOcrPreflight: ), patch( "paperforge.worker.ocr.ensure_ocr_meta", - return_value={}, + return_value={"needs_sanitize": True}, ), patch("paperforge.worker.ocr.write_json"), - patch("builtins.open") as mock_open, + patch("paperforge.worker.ocr.fitz.open") as mock_open, patch("paperforge.worker.ocr.requests.post") as mock_post, patch("paperforge.worker.ocr.requests.get") as mock_get, ):