Files
clice/tests/integration/lifecycle/test_lifecycle.py
ykiko 8b3e3a9595 refactor(tests): reorganize integration tests into domain-based subdirectories (#409)
## 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>
2026-04-09 02:40:10 +08:00

28 lines
810 B
Python

"""Lifecycle tests for the clice LSP server."""
import pytest
from lsprotocol.types import ClientCapabilities, InitializeParams
@pytest.mark.workspace("hello_world")
async def test_initialize(client, workspace):
assert client.init_result is not None
assert client.init_result.server_info is not None
assert client.init_result.server_info.name == "clice"
@pytest.mark.workspace("hello_world")
async def test_double_initialize_rejected(client, workspace):
with pytest.raises(Exception):
await client.initialize_async(
InitializeParams(
capabilities=ClientCapabilities(),
workspace_folders=[],
)
)
@pytest.mark.workspace("hello_world")
async def test_shutdown(client, workspace):
await client.shutdown_async(None)