mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-11-17 14:51:50 +02:00
feat(cli): tell people at a terminal about a newer release and Tauric's notices
- once a day a background thread records the latest GitHub release and the notices for each version; the welcome screen shows them from that cache, so no run waits on the network - the release notice names the upgrade command for how TradingAgents was installed - TRADINGAGENTS_NO_UPDATE_CHECK=1 turns the check off; unattended and CI runs never make it - notices are read from a new `notices` key, so earlier versions keep reading `announcements`
This commit is contained in:
@@ -56,8 +56,7 @@ def test_flags_skip_exactly_their_own_steps(monkeypatch):
|
||||
|
||||
for step in ("get_ticker", "get_analysis_date", "select_analysts"):
|
||||
monkeypatch.setattr(selections, step, no_prompt)
|
||||
monkeypatch.setattr(selections, "fetch_announcements", lambda: None)
|
||||
monkeypatch.setattr(selections, "display_announcements", lambda *a: None)
|
||||
monkeypatch.setattr(selections.updates, "enabled", lambda: False)
|
||||
|
||||
chosen = selections._prompt_selections({}, FLAGS)
|
||||
|
||||
@@ -119,19 +118,6 @@ def test_save_and_show_answer_the_questions_after_the_run(monkeypatch, tmp_path)
|
||||
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_an_announcement_does_not_wait_for_enter_without_a_terminal(monkeypatch):
|
||||
from cli import announcements
|
||||
from cli.display import console
|
||||
|
||||
def no_wait(*a):
|
||||
raise AssertionError("waited for Enter with no terminal")
|
||||
|
||||
monkeypatch.setattr(announcements.getpass, "getpass", no_wait)
|
||||
monkeypatch.setattr(announcements.sys.stdin, "isatty", lambda: False)
|
||||
announcements.display_announcements(console, {"content": "Maintenance tonight", "require_attention": True})
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_a_missing_key_without_a_terminal_names_the_variable(monkeypatch, capsys):
|
||||
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
|
||||
@@ -200,8 +186,7 @@ def test_an_unknown_analyst_error_names_the_analysts_as_users_know_them():
|
||||
def _selections_with_env(monkeypatch, keys=None):
|
||||
for name, value in UNATTENDED_ENV.items():
|
||||
monkeypatch.setenv(name, value)
|
||||
monkeypatch.setattr(selections, "fetch_announcements", lambda: None)
|
||||
monkeypatch.setattr(selections, "display_announcements", lambda *a: None)
|
||||
monkeypatch.setattr(selections.updates, "enabled", lambda: False)
|
||||
checked = keys if keys is not None else []
|
||||
monkeypatch.setattr(selections, "ensure_api_key", lambda provider: checked.append(provider))
|
||||
return checked
|
||||
|
||||
Reference in New Issue
Block a user