NLProxy / nlproxy /docs /tests.md
Luiserb's picture
first commit
2129c29
|
Raw
History Blame Contribute Delete
1.73 kB

A newer version of the Gradio SDK is available: 6.19.0

Upgrade

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.