Files
nx_post_support/server/tests/python_tests/conftest.py
T
Christoph Brandau 53ebc5d055 chore(lsprotocol): migrate to 2025.0.0 and cleanup artifacts
The changes align the project with the 2025.0.0 lsprotocol
release, removing the old backport and updating type hints
in the protocol hooks to use Sequence where appropriate. The
dist-info and packaging metadata for older lsprotocol
versions are replaced with the new 2025.0.0 artifacts.

- Remove exceptiongroup backport used on Python <3.11
- Use Sequence instead of List in LS protocol hooks
- Replace old dist-info with 2025.0.0 metadata
2026-09-03 08:39:12 +02:00

27 lines
853 B
Python

"""Shared pytest setup for the language server."""
import sys
from pathlib import Path
import pytest
THIS_DIR = Path(__file__).parent
SRC_DIR = THIS_DIR.parent.parent / "src"
if str(SRC_DIR) not in sys.path:
sys.path.insert(0, str(SRC_DIR))
import lsprotocol.types as lsp # type: ignore # noqa: E402
from lsp_server import LSP_SERVER # type: ignore # noqa: E402
from pygls.workspace import Workspace # noqa: E402
@pytest.fixture(scope="session", autouse=True)
def initialize_test_workspace() -> None:
"""Provide the workspace that pygls 2 creates during LSP initialization."""
LSP_SERVER.protocol._workspace = Workspace( # pylint: disable=protected-access
root_uri=None,
sync_kind=lsp.TextDocumentSyncKind.Incremental,
workspace_folders=[],
position_encoding=lsp.PositionEncodingKind.Utf16,
)