test(issue-21): rec 3 - T2-6 isolates MAM_LOOP_WORKTREE/MAM_LOOP_BASE with monkeypatch
T2-6 set both variables in os.environ directly and restored them in a finally block; a failing assertion between the two could still leak them to later tests in the process. They are now set with monkeypatch.setenv (the wt_repo fixture already delenvs both). The assertions are unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017R3Eg7MEpSWnm1oB9ZPP6G
This commit is contained in:
1 parent
25f4be3359
commit
4ad622e372
1 file changed
+3
-7
@@ -362,13 +362,12 @@ def test_t2_5b_prompts_unchanged_without_options(wt_repo, monkeypatch, tmp_path)
|
|||||||
assert _roles(calls, "Reviewer")[0].startswith("다음 구현 사항(작업 목표: t21)")
|
assert _roles(calls, "Reviewer")[0].startswith("다음 구현 사항(작업 목표: t21)")
|
||||||
|
|
||||||
|
|
||||||
def test_t2_6_worktree_env_fallback_and_no_base_env(wt_repo, tmp_path):
|
def test_t2_6_worktree_env_fallback_and_no_base_env(wt_repo, tmp_path, monkeypatch):
|
||||||
main, wt = wt_repo
|
main, wt = wt_repo
|
||||||
wt2 = tmp_path / "wt2"
|
wt2 = tmp_path / "wt2"
|
||||||
_git(main, "worktree", "add", "-q", "-b", "feat2", str(wt2))
|
_git(main, "worktree", "add", "-q", "-b", "feat2", str(wt2))
|
||||||
os.environ["MAM_LOOP_WORKTREE"] = str(wt)
|
monkeypatch.setenv("MAM_LOOP_WORKTREE", str(wt))
|
||||||
os.environ["MAM_LOOP_BASE"] = _git(main, "rev-parse", "HEAD")
|
monkeypatch.setenv("MAM_LOOP_BASE", _git(main, "rev-parse", "HEAD"))
|
||||||
try:
|
|
||||||
r = _runner()
|
r = _runner()
|
||||||
r.parse_args()
|
r.parse_args()
|
||||||
assert r.worktree_root == Path(os.path.realpath(wt)) and r.worktree_given
|
assert r.worktree_root == Path(os.path.realpath(wt)) and r.worktree_given
|
||||||
@@ -376,9 +375,6 @@ def test_t2_6_worktree_env_fallback_and_no_base_env(wt_repo, tmp_path):
|
|||||||
r = _runner("--worktree", str(wt2))
|
r = _runner("--worktree", str(wt2))
|
||||||
r.parse_args()
|
r.parse_args()
|
||||||
assert r.worktree_root == Path(os.path.realpath(wt2)), "the CLI wins over MAM_LOOP_WORKTREE"
|
assert r.worktree_root == Path(os.path.realpath(wt2)), "the CLI wins over MAM_LOOP_WORKTREE"
|
||||||
finally:
|
|
||||||
os.environ.pop("MAM_LOOP_WORKTREE", None)
|
|
||||||
os.environ.pop("MAM_LOOP_BASE", None)
|
|
||||||
|
|
||||||
|
|
||||||
def test_t2_7_runner_reads_mam_jobs_dir(wt_repo, tmp_path, monkeypatch):
|
def test_t2_7_runner_reads_mam_jobs_dir(wt_repo, tmp_path, monkeypatch):
|
||||||
|
|||||||
Reference in new issue
Block a user