diff --git a/packages/claude-code-plugin/tests/test_hud.py b/packages/claude-code-plugin/tests/test_hud.py index 64f63f55..a776db30 100644 --- a/packages/claude-code-plugin/tests/test_hud.py +++ b/packages/claude-code-plugin/tests/test_hud.py @@ -743,6 +743,14 @@ def test_no_content_with_blockers_returns_empty(self): class TestIntegration: + # Isolate HUD state so tests don't read the real session file. + # Without this, select_face_from_state picks up the live session's + # mode (e.g. PLAN → ◔‿◔) instead of returning the idle face (◕‿◕). + _ISOLATED_ENV = { + **os.environ, + "CODINGBUDDY_HUD_STATE_FILE": "/tmp/_test_hud_nonexistent_state.json", + } + def test_pipe_stdin(self): """Run the script as a subprocess with piped stdin.""" script = os.path.join(_hooks_dir, "codingbuddy-hud.py") @@ -766,6 +774,7 @@ def test_pipe_stdin(self): input=stdin_data, capture_output=True, text=True, + env=self._ISOLATED_ENV, ) assert result.returncode == 0 assert "\u25d5\u203f\u25d5" in result.stdout # ◕‿◕ @@ -793,6 +802,7 @@ def test_pipe_stdin_estimated_cost(self): input=stdin_data, capture_output=True, text=True, + env=self._ISOLATED_ENV, ) assert result.returncode == 0 assert "~$" in result.stdout @@ -805,6 +815,7 @@ def test_empty_stdin_fallback(self): input="", capture_output=True, text=True, + env=self._ISOLATED_ENV, ) assert result.returncode == 0 assert "\u25d5\u203f\u25d5" in result.stdout