Merge pull request #225 from Gujiassh/fix/save-output-utf8
fix(cli): Write saved output using UTF-8 encoding
This commit is contained in:
@@ -103,7 +103,7 @@ def save_output(report: schema.Report, emit: str, save_dir: str, suffix: str = "
|
|||||||
content = emit_output(report, emit)
|
content = emit_output(report, emit)
|
||||||
else:
|
else:
|
||||||
content = render.render_full(report)
|
content = render.render_full(report)
|
||||||
out_path.write_text(content)
|
out_path.write_text(content, encoding="utf-8")
|
||||||
return out_path
|
return out_path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,14 @@ class CliV3Tests(unittest.TestCase):
|
|||||||
payload = json.loads(path.read_text())
|
payload = json.loads(path.read_text())
|
||||||
self.assertEqual("OpenClaw vs NanoClaw", payload["topic"])
|
self.assertEqual("OpenClaw vs NanoClaw", payload["topic"])
|
||||||
|
|
||||||
|
def test_save_output_writes_utf8_encoded_markdown(self):
|
||||||
|
report = self.make_report()
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
with mock.patch("pathlib.Path.write_text", autospec=True, return_value=1) as write_text:
|
||||||
|
cli.save_output(report, "md", tmp)
|
||||||
|
_, kwargs = write_text.call_args
|
||||||
|
self.assertEqual("utf-8", kwargs.get("encoding"))
|
||||||
|
|
||||||
def test_persist_report_updates_run_status_on_success_and_failure(self):
|
def test_persist_report_updates_run_status_on_success_and_failure(self):
|
||||||
report = self.make_report()
|
report = self.make_report()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user