Fix MCP close tool method signature error (GH #107)
Renamed BdDaemonClient.close() cleanup method to cleanup() to eliminate method name collision with async close(params) method for closing issues. Root cause: Python method resolution meant the non-async close(self) cleanup method was shadowing the async close(self, params) method that closes issues, causing 'takes 1 positional argument but 2 were given'. Changes: - bd_daemon_client.py: Renamed close() -> cleanup() - server.py: Updated cleanup code to call cleanup() instead of close() - test_lifecycle.py: Updated tests to use cleanup() All close-related tests pass. Fixes GitHub issue #107. Tracked in bd-67 (closed).
This commit is contained in:
@@ -40,8 +40,8 @@ def test_cleanup_function_safe_to_call_multiple_times():
|
||||
cleanup()
|
||||
cleanup()
|
||||
|
||||
# Client should only be closed once
|
||||
assert mock_client.close.call_count == 1
|
||||
# Client should only be cleaned up once
|
||||
assert mock_client.cleanup.call_count == 1
|
||||
assert len(_daemon_clients) == 0
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ def test_cleanup_handles_client_errors_gracefully():
|
||||
|
||||
# Create mock clients - one that raises, one that doesn't
|
||||
failing_client = MagicMock()
|
||||
failing_client.close.side_effect = Exception("Connection failed")
|
||||
failing_client.cleanup.side_effect = Exception("Connection failed")
|
||||
|
||||
good_client = MagicMock()
|
||||
|
||||
@@ -66,8 +66,8 @@ def test_cleanup_handles_client_errors_gracefully():
|
||||
cleanup()
|
||||
|
||||
# Both clients should have been attempted
|
||||
assert failing_client.close.called
|
||||
assert good_client.close.called
|
||||
assert failing_client.cleanup.called
|
||||
assert good_client.cleanup.called
|
||||
assert len(_daemon_clients) == 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user