jeanbaptdzd's picture
feat: Clean deployment to HuggingFace Space with model config test endpoint
8c0b652

Test Suite

Comprehensive test coverage for the LinguaCustodia Financial AI API.

Running Tests

Prerequisites

  1. Start the API server: python app_clean.py
  2. Install test dependencies: pip install pytest requests

Run Tests

# Run all tests
pytest tests/

# Run specific test files
pytest tests/test_api.py
pytest tests/test_inference.py
pytest tests/test_openai_compatibility.py

# Run with verbose output
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=app

Test Categories

test_api.py

  • Health check endpoint
  • Models listing endpoints
  • Import diagnosis endpoint
  • Basic API functionality

test_inference.py

  • Basic inference functionality
  • Different model parameters
  • Error handling
  • Performance timing

test_openai_compatibility.py

  • Chat completions endpoint
  • Text completions endpoint
  • JSON response format
  • Streaming responses
  • RAG document analysis

Test Configuration

Tests automatically skip if the API server is not running. The conftest.py file handles:

  • API availability checking
  • Automatic test skipping
  • Common fixtures

Expected Behavior

All tests should pass when the API is running properly. Tests cover:

  • βœ… API endpoint availability
  • βœ… Response format validation
  • βœ… OpenAI compatibility
  • βœ… Error handling
  • βœ… Performance expectations