refactor(cli): save a run's reports through the graph, as a script does

- TradingAgentsGraph.default_report_path names the results_dir/reports/TICKER_stamp folder; save_reports and the CLI both use it
This commit is contained in:
Yijia-Xiao
2026-09-29 05:57:18 +00:00
parent ad39133569
commit e1a19fd78e
4 changed files with 20 additions and 19 deletions
+4 -2
View File
@@ -50,8 +50,10 @@ def test_save_reports_explicit_path(tmp_path):
@pytest.mark.unit
def test_save_reports_defaults_under_results_dir(tmp_path):
mock_self = SimpleNamespace(config={"results_dir": str(tmp_path)}, run_settings=lambda: SETTINGS)
out = TradingAgentsGraph.save_reports(mock_self, _state(), "AAPL")
graph = object.__new__(TradingAgentsGraph)
graph.config = {"results_dir": str(tmp_path)}
graph.run_settings = lambda: SETTINGS
out = graph.save_reports(_state(), "AAPL")
assert out.exists()
assert out.parent.parent.name == "reports" # results_dir/reports/AAPL_<stamp>/...
assert out.parent.name.startswith("AAPL_")