8000 Remove parameters from async handler (#320) · python-lsp/python-lsp-server@95d7535 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95d7535

Browse files
authored
Remove parameters from async handler (#320)
1 parent aaa362c commit 95d7535

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

pyls/jsonrpc/endpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _handle_notification(self, method, params):
146146

147147
if callable(handler_result):
148148
log.debug("Executing async notification handler %s", handler_result)
149-
notification_future = self._executor_service.submit(handler_result, params)
149+
notification_future = self._executor_service.submit(handler_result)
150150
notification_future.add_done_callback(self._notification_callback(method, params))
151151

152152
@staticmethod
@@ -183,7 +183,7 @@ def _handle_request(self, msg_id, method, params):
183183

184184
if callable(handler_result):
185185
log.debug("Executing async request handler %s", handler_result)
186-
request_future = self._executor_service.submit(handler_result, params)
186+
request_future = self._executor_service.submit(handler_result)
187187
self._client_request_futures[msg_id] = request_future
188188
request_future.add_done_callback(self._request_callback(msg_id))
189189
else:

test/jsonrpc/test_endpoint.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ def test_consume_notification_method_not_found(endpoint):
153153

154154

155155
def test_consume_async_notification_error(endpoint, dispatcher):
156-
def _async_handler(params):
157-
assert params == {'key': 'value'}
156+
def _async_handler():
158157
raise ValueError()
159158
handler = mock.Mock(return_value=_async_handler)
160159
dispatcher['methodName'] = handler
@@ -189,8 +188,7 @@ def test_consume_request(endpoint, consumer, dispatcher):
189188

190189

191190
def test_consume_async_request(endpoint, consumer, dispatcher):
192-
def _async_handler(params):
193-
assert params == {'key': 'value'}
191+
def _async_handler():
194192
return 1234
195193
handler = mock.Mock(return_value=_async_handler)
196194
dispatcher['methodName'] = handler
@@ -216,8 +214,7 @@ def _async_handler(params):
216214
(exceptions.JsonRpcMethodNotFound, exceptions.JsonRpcMethodNotFound()),
217215
])
218216
def test_consume_async_request_error(exc_type, error, endpoint, consumer, dispatcher):
219-
def _async_handler(params):
220-
assert params == {'key': 'value'}
217+
def _async_handler():
221218
raise exc_type()
222219
handler = mock.Mock(return_value=_async_handler)
223220
dispatcher['methodName'] = handler
@@ -264,8 +261,7 @@ def test_consume_request_error(exc_type, error, endpoint, consumer, dispatcher):
264261

265262

266263
def test_consume_request_cancel(endpoint, dispatcher):
267-
def async_handler(params):
268-
assert params == {'key': 'value'}
264+
def async_handler():
269265
time.sleep(3)
270266
handler = mock.Mock(return_value=async_handler)
271267
dispatcher['methodName'] = handler

0 commit comments

Comments
 (0)
0