Spaces:
Running
Running
File size: 1,734 Bytes
2129c29 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # NLProxy Test Suite Reference
This document describes the repository test harness in `tests.py`.
## Purpose
The single `tests.py` module contains the repository's automated test definitions, fixtures, and pytest integration hooks.
## Testing Coverage
The file includes test classes for:
- `TestPromptShield`
- `TestSemanticSegmenter`
- `TestSemanticCompressor`
- `TestPromptReconstructor`
- `TestSafetyChecker`
- `TestResponseCorrector`
- `TestPostLLMVerifier`
- `TestPromptFirewall`
- `TestSemanticLLMCache`
- `TestCompressionServiceIntegration`
- `TestProxyEndpointIntegration`
- `TestPerformance`
- `TestRegression`
## Helper Functions
- `test_config()`
- `sample_prompts()`
- `mock_embedding()`
- `mock_embeddings(sample_prompts)`
- `mock_nli_response()`
- `mock_llm_response()`
- `mock_redis_client()`
- `mock_http_client()`
- `mock_tokenizer()`
These helpers provide deterministic test fixtures for core logic, caching, and provider simulation.
## CLI & Test Runner Integration
The file also defines pytest plugin hooks:
- `pytest_configure(config)`
- `pytest_collection_modifyitems(config, items)`
- `pytest_report_header(terminalreporter, exitstatus, config)`
- `pytest_terminal_summary(terminalreporter, exitstatus, config)`
## Usage
The test harness is designed for use with `pytest` and can be invoked through the CLI wrapper in `cli/tests.py`.
### Recommended Commands
- `python -m nlproxy.cli.tests`
- `pytest tests.py`
## Notes
- The module is structured to support both unit and integration tests in a single file.
- Test classes may depend on fixtures defined in helper functions rather than external frameworks.
- The file is the authoritative reference for existing coverage and validation flows.
|