chore: add integration test for workspace/textDocumentContent - #2981
Open
rwols wants to merge 6 commits into
Open
chore: add integration test for workspace/textDocumentContent#2981rwols wants to merge 6 commits into
rwols wants to merge 6 commits into
Conversation
rchl
reviewed
Jul 6, 2026
| self.session.send_request(Request("$test/setResponses", payload), handler, error_handler) | ||
| yield from self.await_promise(promise) | ||
|
|
||
| def mock_command_action(self, command_name: str, action: LSPObject) -> Generator: |
Member
There was a problem hiding this comment.
You can probably use ServerRequest type for action.
If not then create a more generic type that takes method and params keys.
rchl
reviewed
Jul 6, 2026
rchl
reviewed
Jul 6, 2026
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
rchl
reviewed
Jul 23, 2026
| self.session.send_request(Request("$test/setResponses", payload), handler, error_handler) | ||
| yield from self.await_promise(promise) | ||
|
|
||
| def mock_command_action(self, command_name: str, action: ServerRequest) -> Generator: |
Member
There was a problem hiding this comment.
I wouldn't call it "mocking". That would be more when we would force some response without going through the server. Maybe set_command_response_action would be more consistent with other server methods. Or just set_command_response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This teaches our fake server in tests/server.py to execute a server->client request when receiving a command. With this, we can set up an integration test that makes the fake server do a
window/showDocumentrequest when receiving aworkspace/executeCommandrequest. In turn, that will then cause the client to make aworkspace/textDocumentContentrequest.So the request flow is:
workspace/executeCommandwindow/showDocumentworkspace/textDocumentContentworkspace/textDocumentContentwindow/showDocumentworkspace/executeCommandI also ported along the
$test/getAndClearUnusedMockResponsesmethod, but that remains unused for now.