Skip to content

Commit 75cd3f5

Browse files
committed
fix(tests): isolate HUD state file in TestIntegration subprocess tests
Set CODINGBUDDY_HUD_STATE_FILE to a nonexistent path so integration tests don't read the live session's hud_state.json. Previously, the subprocess picked up the real session mode (e.g. PLAN → ◔‿◔ thinking face) instead of the expected idle face (◕‿◕).
1 parent be6502d commit 75cd3f5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/claude-code-plugin/tests/test_hud.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,14 @@ def test_no_content_with_blockers_returns_empty(self):
743743

744744

745745
class TestIntegration:
746+
# Isolate HUD state so tests don't read the real session file.
747+
# Without this, select_face_from_state picks up the live session's
748+
# mode (e.g. PLAN → ◔‿◔) instead of returning the idle face (◕‿◕).
749+
_ISOLATED_ENV = {
750+
**os.environ,
751+
"CODINGBUDDY_HUD_STATE_FILE": "/tmp/_test_hud_nonexistent_state.json",
752+
}
753+
746754
def test_pipe_stdin(self):
747755
"""Run the script as a subprocess with piped stdin."""
748756
script = os.path.join(_hooks_dir, "codingbuddy-hud.py")
@@ -766,6 +774,7 @@ def test_pipe_stdin(self):
766774
input=stdin_data,
767775
capture_output=True,
768776
text=True,
777+
env=self._ISOLATED_ENV,
769778
)
770779
assert result.returncode == 0
771780
assert "\u25d5\u203f\u25d5" in result.stdout # ◕‿◕
@@ -793,6 +802,7 @@ def test_pipe_stdin_estimated_cost(self):
793802
input=stdin_data,
794803
capture_output=True,
795804
text=True,
805+
env=self._ISOLATED_ENV,
796806
)
797807
assert result.returncode == 0
798808
assert "~$" in result.stdout
@@ -805,6 +815,7 @@ def test_empty_stdin_fallback(self):
805815
input="",
806816
capture_output=True,
807817
text=True,
818+
env=self._ISOLATED_ENV,
808819
)
809820
assert result.returncode == 0
810821
assert "\u25d5\u203f\u25d5" in result.stdout

0 commit comments

Comments
 (0)