From 2edb46c9153fc3bd2adbff4cf01c86ad407bde9e Mon Sep 17 00:00:00 2001 From: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com> Date: Sun, 17 May 2026 17:33:33 -0700 Subject: [PATCH] test: extract workspace env cleanup helper Use _clear_workspace_env in workspace selection tests so local HOTDATA_WORKSPACE values do not leak between cases. --- tests/test_client.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index fc5ccdb..9d3a025 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -10,6 +10,10 @@ from hotdata_runtime.client import HotdataClient +def _clear_workspace_env(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False) + + @pytest.mark.parametrize( ("raw", "expected"), [ @@ -44,9 +48,8 @@ def test_resolve_workspace_selection_prefers_env_without_listing( assert resolved.workspaces == [] - def test_pick_workspace_chooses_first_active(monkeypatch: pytest.MonkeyPatch): - monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False) + _clear_workspace_env(monkeypatch) items = [ SimpleNamespace(public_id="ws_1", active=False), @@ -61,7 +64,7 @@ def test_pick_workspace_chooses_first_active(monkeypatch: pytest.MonkeyPatch): def test_pick_workspace_falls_back_to_first(monkeypatch: pytest.MonkeyPatch): - monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False) + _clear_workspace_env(monkeypatch) items = [ SimpleNamespace(public_id="ws_1", active=False), @@ -75,7 +78,7 @@ def test_pick_workspace_falls_back_to_first(monkeypatch: pytest.MonkeyPatch): def test_resolve_workspace_selection_source_first(monkeypatch: pytest.MonkeyPatch): - monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False) + _clear_workspace_env(monkeypatch) items = [ SimpleNamespace(public_id="ws_1", active=False), SimpleNamespace(public_id="ws_2", active=False), @@ -94,7 +97,7 @@ def test_resolve_workspace_selection_source_first(monkeypatch: pytest.MonkeyPatc def test_resolve_workspace_selection_returns_workspaces_and_source( monkeypatch: pytest.MonkeyPatch, ): - monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False) + _clear_workspace_env(monkeypatch) items = [ SimpleNamespace(public_id="ws_1", active=False),