Skip to content

Commit 2edb46c

Browse files
committed
test: extract workspace env cleanup helper
Use _clear_workspace_env in workspace selection tests so local HOTDATA_WORKSPACE values do not leak between cases.
1 parent b68ca07 commit 2edb46c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

tests/test_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
from hotdata_runtime.client import HotdataClient
1111

1212

13+
def _clear_workspace_env(monkeypatch: pytest.MonkeyPatch) -> None:
14+
monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False)
15+
16+
1317
@pytest.mark.parametrize(
1418
("raw", "expected"),
1519
[
@@ -44,9 +48,8 @@ def test_resolve_workspace_selection_prefers_env_without_listing(
4448
assert resolved.workspaces == []
4549

4650

47-
4851
def test_pick_workspace_chooses_first_active(monkeypatch: pytest.MonkeyPatch):
49-
monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False)
52+
_clear_workspace_env(monkeypatch)
5053

5154
items = [
5255
SimpleNamespace(public_id="ws_1", active=False),
@@ -61,7 +64,7 @@ def test_pick_workspace_chooses_first_active(monkeypatch: pytest.MonkeyPatch):
6164

6265

6366
def test_pick_workspace_falls_back_to_first(monkeypatch: pytest.MonkeyPatch):
64-
monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False)
67+
_clear_workspace_env(monkeypatch)
6568

6669
items = [
6770
SimpleNamespace(public_id="ws_1", active=False),
@@ -75,7 +78,7 @@ def test_pick_workspace_falls_back_to_first(monkeypatch: pytest.MonkeyPatch):
7578

7679

7780
def test_resolve_workspace_selection_source_first(monkeypatch: pytest.MonkeyPatch):
78-
monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False)
81+
_clear_workspace_env(monkeypatch)
7982
items = [
8083
SimpleNamespace(public_id="ws_1", active=False),
8184
SimpleNamespace(public_id="ws_2", active=False),
@@ -94,7 +97,7 @@ def test_resolve_workspace_selection_source_first(monkeypatch: pytest.MonkeyPatc
9497
def test_resolve_workspace_selection_returns_workspaces_and_source(
9598
monkeypatch: pytest.MonkeyPatch,
9699
):
97-
monkeypatch.delenv("HOTDATA_WORKSPACE", raising=False)
100+
_clear_workspace_env(monkeypatch)
98101

99102
items = [
100103
SimpleNamespace(public_id="ws_1", active=False),

0 commit comments

Comments
 (0)