Files
2026-07-22 13:48:46 +08:00

53 lines
1.3 KiB
Markdown

# Context System Tests
This directory contains tests for the Context system. The tests verify Redis-backed history storage, file-system persistence, message management, context management, serialization, concurrency behavior, and error handling.
## Files
- `test_context_system.py`: complete pytest suite.
- `test_context_basic.py`: basic validation script that does not require pytest.
- `test_context_simple.py`: simplified quick-check script.
- `run_context_tests.py`: helper script for dependency checks, Redis checks, test execution, and reporting.
## Run
Start Redis first:
```bash
redis-server
```
Run the quick validation:
```bash
python test/test_context_simple.py
```
Run the full pytest suite:
```bash
pytest test/test_context_system.py -v
```
Or use the helper runner:
```bash
python test/run_context_tests.py
```
## Coverage
- Redis connection and message storage
- File persistence and restore
- Message retrieval, search, and count limits
- Context creation, lookup, batch save, and cleanup
- Serialization and metadata handling
- Concurrent access safety
- Error handling and automatic summaries
## Notes
- Tests use Redis DB 13-15 to avoid affecting production data.
- File-system tests use temporary directories and clean up after themselves.
- See [TEST_RESULTS.md](./TEST_RESULTS.md) for the historical result summary.