Skip to content

Commit ad278cd

Browse files
committed
style(soul,tests): address CodeRabbit type/hygiene nits
- slash.py: annotate the new accept_edits handler with -> None (public src rule). - test_pythinkersoul_steer.py: annotate the finish_reason test-double property. - test_agent_tool.py: replace the hardcoded /tmp agent_file with the in-file runtime.subagent_store.root pattern, and split the combined assertion for clearer failure messages.
1 parent e97123f commit ad278cd

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/pythinker_code/soul/slash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ async def auto(soul: PythinkerSoul, args: str):
207207

208208

209209
@registry.command(name="accept-edits")
210-
async def accept_edits(soul: PythinkerSoul, args: str):
210+
async def accept_edits(soul: PythinkerSoul, args: str) -> None:
211211
"""Toggle accept-edits mode (auto-approve reversible in-workspace file edits)"""
212212
approval = soul.runtime.approval
213213
if approval.is_accept_edits():

tests/core/test_pythinkersoul_steer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def usage(self):
452452
return None
453453

454454
@property
455-
def finish_reason(self):
455+
def finish_reason(self) -> str | None:
456456
return None
457457

458458

tests/tools/test_agent_tool.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import asyncio
44
import re
5-
from pathlib import Path
65
from types import SimpleNamespace
76

87
import pytest
@@ -72,11 +71,12 @@ def test_check_required_mcp_servers_gates_absent_server(runtime: Runtime) -> Non
7271
from pythinker_code.subagents import AgentTypeDefinition, ToolPolicy
7372
from pythinker_code.tools.agent import AgentTool
7473

74+
assert runtime.subagent_store is not None # populated by the runtime fixture
7575
runtime.labor_market.add_builtin_type(
7676
AgentTypeDefinition(
7777
name="needs_db",
7878
description="needs the db MCP server",
79-
agent_file=Path("/tmp/needs_db.yaml"),
79+
agent_file=runtime.subagent_store.root / "needs_db.yaml",
8080
tool_policy=ToolPolicy(mode="inherit"),
8181
required_mcp_servers=("db",),
8282
)
@@ -85,7 +85,8 @@ def test_check_required_mcp_servers_gates_absent_server(runtime: Runtime) -> Non
8585

8686
runtime.mcp_status = lambda: None # no MCP configured -> required server absent
8787
err = tool.check_required_mcp_servers("needs_db")
88-
assert err is not None and "db" in err.message
88+
assert err is not None
89+
assert "db" in err.message
8990

9091
runtime.mcp_status = lambda: _mcp_snapshot(True, []) # still loading -> allow
9192
assert tool.check_required_mcp_servers("needs_db") is None

0 commit comments

Comments
 (0)