fix(refactor): address reviewer findings R-1..R-8, achieve 31/31 test pass
This commit is contained in:
@@ -12,6 +12,8 @@ def run_lib_func(mam_sandbox, func_name, *args, env=None):
|
||||
lib_path = mam_sandbox / "skills" / "lib.sh"
|
||||
cmd_str = f"source {lib_path} && {func_name} " + " ".join(shlex.quote(str(a)) for a in args)
|
||||
run_env = dict(os.environ)
|
||||
run_env.pop("HERDR_SESSION_NAME", None)
|
||||
run_env.pop("HERDR_SERVER_NAME", None)
|
||||
if env:
|
||||
run_env.update(env)
|
||||
res = subprocess.run(["bash", "-c", cmd_str], capture_output=True, text=True, env=run_env)
|
||||
@@ -111,10 +113,14 @@ def test_resume_resolve_herdr_session_default(mam_sandbox):
|
||||
assert res.stdout.strip() != ""
|
||||
|
||||
def test_resume_resolve_herdr_session_env(mam_sandbox):
|
||||
"""Test resolve_herdr_workspace fallback to HERDR_SERVER_NAME env var."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_workspace", "non-existent-session", env={"HERDR_SERVER_NAME": "custom_server"})
|
||||
"""Test resolve_herdr_workspace fallback to HERDR_SESSION_NAME or HERDR_SERVER_NAME env var."""
|
||||
res = run_lib_func(mam_sandbox, "resolve_herdr_workspace", "non-existent-session", env={"HERDR_SESSION_NAME": "custom_session"})
|
||||
assert res.returncode == 0
|
||||
assert res.stdout.strip() == "custom_server"
|
||||
assert res.stdout.strip() == "custom_session"
|
||||
|
||||
res_legacy = run_lib_func(mam_sandbox, "resolve_herdr_workspace", "non-existent-session", env={"HERDR_SERVER_NAME": "custom_server"})
|
||||
assert res_legacy.returncode == 0
|
||||
assert res_legacy.stdout.strip() == "custom_server"
|
||||
|
||||
def test_resume_find_workspace_uuid_empty(mam_sandbox):
|
||||
"""Test find_workspace_uuid returns empty string for non-existent workspace."""
|
||||
|
||||
Reference in New Issue
Block a user