mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 15:02:39 +03:00
test: keep the CLI's saved selections out of the user's home (#1395)
- every test saves and reads CLI selections under its own tmp_path
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""The suite runs the same on any machine: no test reaches the network."""
|
||||
"""The suite runs the same on any machine: no test reaches the network or the user's files."""
|
||||
|
||||
import socket
|
||||
|
||||
@@ -15,3 +15,15 @@ def test_a_test_cannot_reach_the_network(connect):
|
||||
machine it runs on; conftest refuses the connection instead."""
|
||||
with pytest.raises(OSError, match="reach the network"):
|
||||
connect()
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_a_test_saves_cli_selections_to_its_own_directory(tmp_path):
|
||||
"""The CLI remembers the last run's selections in the user's home; a test
|
||||
that runs the selection flow would otherwise overwrite them."""
|
||||
from cli import prefs
|
||||
|
||||
prefs.save_last_run({"analysts": ["market"]})
|
||||
|
||||
assert prefs._PREFS_PATH.is_relative_to(tmp_path)
|
||||
assert prefs._PREFS_PATH.exists()
|
||||
|
||||
Reference in New Issue
Block a user