Skip to content

"Vibe-Trading: Your Personal Trading Agent"

test(pdf): confine replace-failure injection to the renderer module

Haozhe Wu251b094320c1
diff --git a/agent/tests/test_pdf_report_arabic.py b/agent/tests/test_pdf_report_arabic.py
index 780a21af0..ac19aeb89 100644
--- a/agent/tests/test_pdf_report_arabic.py
+++ b/agent/tests/test_pdf_report_arabic.py
@@ -113,7 +113,9 @@ def test_arabic_render_failure_retains_old_target_and_cleans_temporary(tmp_path,
else:
def denied(*args):
raise OSError("replace denied")
- monkeypatch.setattr(pdf_report.os, "replace", denied)
+ from tests.module_os_helpers import patch_module_os
+
+ patch_module_os(monkeypatch, pdf_report, replace=denied)
with pytest.raises((ValueError, OSError)):
pdf_report.render_markdown_pdf(content, target)
assert target.read_bytes() == b"previous PDF"