test: project_root 测试隔离真实 settings.json——补 get_setting patch
This commit is contained in:
@@ -82,8 +82,11 @@ class TestGetWorkspaceRoot:
|
||||
workspace.mkdir()
|
||||
(project_root / "pyproject.toml").write_text('name = "myagents"\n')
|
||||
|
||||
with patch.dict(
|
||||
os.environ, {"MYAGENTS_PROJECT_ROOT": str(project_root)}, clear=True
|
||||
with (
|
||||
patch.dict(
|
||||
os.environ, {"MYAGENTS_PROJECT_ROOT": str(project_root)}, clear=True
|
||||
),
|
||||
patch("myagents.settings.get_setting", return_value=""),
|
||||
):
|
||||
result = get_workspace_root()
|
||||
assert result == workspace.resolve()
|
||||
@@ -98,6 +101,7 @@ class TestGetWorkspaceRoot:
|
||||
"myagents.project_root.get_project_root",
|
||||
return_value=tmp_path / ".myagents",
|
||||
),
|
||||
patch("myagents.settings.get_setting", return_value=""),
|
||||
patch("pathlib.Path.home", return_value=home),
|
||||
):
|
||||
result = get_workspace_root()
|
||||
|
||||
Reference in New Issue
Block a user