Skip to content

Commit b0975c4

Browse files
LCR-85: Fix test_harness.py for resolve_harnesses dedup and warnings.warn
- test_duplicate_tools_preserved → test_duplicate_tools_deduplicated: update assertion to len==1 after fix #6 introduced dict.fromkeys de-duplication - test_warns_on_permission_error: replace capsys stdout check with pytest.warns(UserWarning) after fix #5 changed print() to warnings.warn() Co-authored-by: Alexandre Boucaud <aboucaud@users.noreply.github.com>
1 parent 19b5b58 commit b0975c4

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

tests/test_harness.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ def test_multiple_tools(self):
3636
assert len(result) == 3
3737
assert [r.tool_id for r in result] == ["claude", "codex", "cursor"]
3838

39-
def test_duplicate_tools_preserved(self):
39+
def test_duplicate_tools_deduplicated(self):
4040
result = resolve_harnesses(("claude", "claude"))
41-
assert len(result) == 2
41+
assert len(result) == 1
4242

4343
def test_invalid_tool_raises(self):
4444
with pytest.raises(ValueError, match="Unknown tool"):
@@ -138,14 +138,13 @@ def test_noop_on_existing(self, tmp_path: Path):
138138
ensure_dir(existing)
139139
assert existing.is_dir()
140140

141-
def test_warns_on_permission_error(self, capsys, tmp_path: Path):
142-
"""ensure_dir prints a warning on OSError instead of raising."""
141+
def test_warns_on_permission_error(self, tmp_path: Path):
142+
"""ensure_dir emits a warnings.warn() on OSError instead of raising."""
143143
import errno
144144
from unittest.mock import patch
145145

146146
target = tmp_path / "nope"
147147
with patch.object(Path, "mkdir") as mock_mkdir:
148148
mock_mkdir.side_effect = OSError(errno.EACCES, "Permission denied")
149-
ensure_dir(target)
150-
out = capsys.readouterr().out
151-
assert "warning" in out.lower()
149+
with pytest.warns(UserWarning, match="Cannot create directory"):
150+
ensure_dir(target)

0 commit comments

Comments
 (0)