fix(beads-mcp): resolve all mypy type checking errors

- Add mypy override in pyproject.toml to relax strict typing for test files
- Update test fixtures to use _connection_pool instead of deprecated _client
- Fix datetime type mismatches in test fixtures (use datetime objects, not strings)
- Add type annotations to inner functions in test_multi_project_switching.py
- Fix union type handling in test assertions with isinstance checks

Reduces mypy errors from 216 to 0. All 168 tests still pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-26 21:09:46 -08:00
parent 30ea542131
commit ed4630092e
8 changed files with 124 additions and 115 deletions

View File

@@ -65,11 +65,10 @@ async def temp_db(bd_executable):
async def mcp_client(bd_executable, temp_db, monkeypatch):
"""Create MCP client with temporary database."""
from beads_mcp import tools
from beads_mcp.bd_client import BdClient
# Reset client before test
tools._client = None
# Reset connection pool before test
tools._connection_pool.clear()
# Reset context environment variables
os.environ.pop("BEADS_CONTEXT_SET", None)
os.environ.pop("BEADS_WORKING_DIR", None)
@@ -79,12 +78,9 @@ async def mcp_client(bd_executable, temp_db, monkeypatch):
# temp_db is now the .beads directory path
# The workspace root is the parent directory
workspace_root = os.path.dirname(temp_db)
# Disable daemon mode for tests (prevents daemon accumulation and timeouts)
os.environ["BEADS_NO_DAEMON"] = "1"
# Create a pre-configured client with explicit paths (bypasses config loading)
tools._client = BdClient(bd_path=bd_executable, beads_dir=temp_db, working_dir=workspace_root)
# Create test client
async with Client(mcp) as client:
@@ -92,8 +88,8 @@ async def mcp_client(bd_executable, temp_db, monkeypatch):
await client.call_tool("set_context", {"workspace_root": workspace_root})
yield client
# Reset client and context after test
tools._client = None
# Reset connection pool and context after test
tools._connection_pool.clear()
os.environ.pop("BEADS_CONTEXT_SET", None)
os.environ.pop("BEADS_WORKING_DIR", None)
os.environ.pop("BEADS_DB", None)