Pytest plugin for end-to-end testing of language servers
Project description
pytest-lsp: End-to-end testing of language servers with pytest
This plugin is in very early development, it currently implements just enough to support the test suite of the esbonio language server.
pytest-lsp
is a pytest plugin for writing end-to-end tests for language servers.
It works by running the language server in a subprocess and communicating with it over stdio, just like a real language client.
This also means pytest-lsp
can be used to test language servers written in any language - not just Python.
pytest-lsp
relies on the pygls
library for its language server protocol implementation.
import sys
import pytest
import pytest_lsp
from pytest_lsp import ClientServerConfig
@pytest_lsp.fixture(
scope='session',
config=ClientServerConfig(
server_command=[sys.executable, "-m", "esbonio"],
root_uri="file:///path/to/test/project/root/"
),
)
async def client():
pass
@pytest.mark.asyncio
async def test_completion(client):
test_uri="file:///path/to/test/project/root/test_file.rst"
result = await client.completion_request(test_uri, line=5, character=23)
assert len(result.items) > 0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest-lsp-0.1.2.tar.gz
(12.5 kB
view hashes)
Built Distribution
pytest_lsp-0.1.2-py3-none-any.whl
(13.6 kB
view hashes)
Close
Hashes for pytest_lsp-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 114766f9a0e417c40d1efe4014d62a49a63286a6cc248d3465925692ab66f7ec |
|
MD5 | d4e33d04a77471d86b1e104acb3005be |
|
BLAKE2b-256 | b1daf92e6e322d59126f74bde20fb5eb085f59a771c3c68ccd90f1feced04260 |