## Summary - Extract shared test utilities into `tests/integration/utils/` (client, workspace, assertions, wait, cache) - Migrate 12 test files into categorized subdirectories: `lifecycle/`, `compilation/`, `features/`, `modules/`, `extensions/`, `stress/` - Merge `test_include_completion.py` + `test_import_completion.py` → `features/test_completion.py` - Remove stale directory-tree comments and section divider comments ## Test plan - [x] `pytest --collect-only` collects all 113 tests - [x] All test module imports verified - [x] `pixi run format` applied 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Reorganized integration suites: added new feature tests (completion, server) and removed older duplicated modules. * Centralized shared test utilities and assertion helpers for diagnostics, workspace operations, waiting/synchronization, and cache inspection. * **Chores / Refactor** * Standardized test client lifecycle and helper usage across suites for more reliable test flows. * Improved server session lifecycle handling for more predictable document/session resets during tests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.9 KiB
Python
63 lines
1.9 KiB
Python
"""File operation tests for the clice LSP server."""
|
|
|
|
import asyncio
|
|
|
|
import pytest
|
|
from lsprotocol.types import (
|
|
CompletionParams,
|
|
DidCloseTextDocumentParams,
|
|
HoverParams,
|
|
Position,
|
|
SignatureHelpParams,
|
|
VersionedTextDocumentIdentifier,
|
|
)
|
|
|
|
from tests.integration.utils import doc
|
|
from tests.integration.utils.workspace import did_change
|
|
|
|
|
|
@pytest.mark.workspace("hello_world")
|
|
async def test_did_open(client, workspace):
|
|
client.open(workspace / "main.cpp")
|
|
await asyncio.sleep(5)
|
|
|
|
|
|
@pytest.mark.workspace("hello_world")
|
|
async def test_did_change(client, workspace):
|
|
uri, content = client.open(workspace / "main.cpp")
|
|
for i in range(20):
|
|
content += "\n"
|
|
await asyncio.sleep(0.2)
|
|
did_change(client, uri, i + 1, content)
|
|
await asyncio.sleep(5)
|
|
|
|
|
|
@pytest.mark.workspace("clang_tidy")
|
|
async def test_clang_tidy(client, workspace):
|
|
client.open(workspace / "main.cpp")
|
|
await asyncio.sleep(5)
|
|
|
|
|
|
@pytest.mark.workspace("hello_world")
|
|
async def test_hover_save_close(client, workspace):
|
|
main_cpp = workspace / "main.cpp"
|
|
uri, content = client.open(main_cpp)
|
|
hover = await client.text_document_hover_async(
|
|
HoverParams(text_document=doc(uri), position=Position(line=2, character=4))
|
|
)
|
|
assert hover is not None
|
|
assert hover.contents is not None
|
|
await client.text_document_completion_async(
|
|
CompletionParams(text_document=doc(uri), position=Position(line=0, character=0))
|
|
)
|
|
await client.text_document_signature_help_async(
|
|
SignatureHelpParams(
|
|
text_document=doc(uri), position=Position(line=0, character=0)
|
|
)
|
|
)
|
|
client.text_document_did_close(DidCloseTextDocumentParams(text_document=doc(uri)))
|
|
closed_hover = await client.text_document_hover_async(
|
|
HoverParams(text_document=doc(uri), position=Position(line=0, character=0))
|
|
)
|
|
assert closed_hover is None
|