From 95d14c927e1652705bee122c3523d6b1eb5e15e7 Mon Sep 17 00:00:00 2001 From: codeasier Date: Sat, 18 Apr 2026 23:38:16 +0800 Subject: [PATCH] fix: isolate completion test from local .pt-snap/focus.json test_returns_empty_for_no_db fails when a local .pt-snap/focus.json exists because _resolve_db_for_completion() finds it via upward directory search. Fix by chdir-ing to a clean tmp_path. Fixes #52 --- tests/test_completion.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_completion.py b/tests/test_completion.py index 32970db..ef1da27 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -96,7 +96,8 @@ def test_returns_device_ids_from_db(self, tmp_path: Path): else: os.environ["PT_SNAP_DB_PATH"] = old_env - def test_returns_empty_for_no_db(self): + def test_returns_empty_for_no_db(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch): + monkeypatch.chdir(tmp_path) result = complete_device_ids() # Without any DB configured, should return empty list assert result == []