mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-07 18:19:00 +00:00
fix: remove dead _save_user_data function and stale mock
This commit is contained in:
@@ -144,15 +144,6 @@ def _user_data_lock_name() -> str:
|
|||||||
return f"file:{os.path.realpath(_user_data_file())}"
|
return f"file:{os.path.realpath(_user_data_file())}"
|
||||||
|
|
||||||
|
|
||||||
def _save_user_data(data: dict[str, Any]) -> None:
|
|
||||||
try:
|
|
||||||
p = _user_data_file()
|
|
||||||
with store_lock(_user_data_lock_name()):
|
|
||||||
p.write_text(json.dumps(data, indent=2))
|
|
||||||
except (OSError, PermissionError) as e:
|
|
||||||
logger.warning(f"Failed to save user data: {e}")
|
|
||||||
|
|
||||||
|
|
||||||
def update_user_data(updates: dict[str, Any]) -> None:
|
def update_user_data(updates: dict[str, Any]) -> None:
|
||||||
"""Atomically read-modify-write the user data file.
|
"""Atomically read-modify-write the user data file.
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,9 @@ class TestTraceListenerSetup:
|
|||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def mock_user_data_file_io(self):
|
def mock_user_data_file_io(self):
|
||||||
"""Mock user data file I/O to prevent file system pollution between tests"""
|
"""Mock user data file I/O to prevent file system pollution between tests"""
|
||||||
with (
|
with patch(
|
||||||
patch(
|
"crewai.events.listeners.tracing.utils._load_user_data",
|
||||||
"crewai.events.listeners.tracing.utils._load_user_data",
|
return_value={},
|
||||||
return_value={},
|
|
||||||
),
|
|
||||||
patch(
|
|
||||||
"crewai.events.listeners.tracing.utils._save_user_data",
|
|
||||||
return_value=None,
|
|
||||||
),
|
|
||||||
):
|
):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user