CloudMind AI - Tests

This directory contains the test suite for CloudMind AI.

Test Structure

tests/
โ”œโ”€โ”€ unit/              # Unit tests for individual modules
โ”‚   โ”œโ”€โ”€ test_config.py
โ”‚   โ”œโ”€โ”€ test_models.py
โ”‚   โ”œโ”€โ”€ test_providers.py
โ”‚   โ”œโ”€โ”€ test_ai_optimizer.py
โ”‚   โ””โ”€โ”€ test_utils.py
โ””โ”€โ”€ integration/       # Integration tests (to be added)

Running Tests

Run all tests

PYTHONPATH=src pytest tests/

Run only unit tests

PYTHONPATH=src pytest tests/unit/ -v

Run specific test file

PYTHONPATH=src pytest tests/unit/test_config.py -v

Run specific test

PYTHONPATH=src pytest tests/unit/test_config.py::test_settings_default_values -v

Run with coverage

PYTHONPATH=src pytest tests/ --cov=cloudmind --cov-report=html

Test Coverage

Current test coverage includes:

  • โœ… Core configuration management
  • โœ… Data models and validation
  • โœ… Provider factory
  • โœ… AI optimization service
  • โœ… Utility functions

Writing Tests

When adding new tests:

  1. Place unit tests in tests/unit/
  2. Place integration tests in tests/integration/
  3. Follow the naming convention: test_*.py
  4. Use pytest fixtures for reusable test data
  5. Keep tests focused and independent

Example Test

import pytest
from cloudmind.core.models import CloudProvider

def test_cloud_provider_enum():
    """Test CloudProvider enum values."""
    assert CloudProvider.AWS.value == "aws"
    assert CloudProvider.AZURE.value == "azure"

Dependencies

Tests require:

  • pytest
  • pytest-asyncio (for async tests)

Install with:

pip install pytest pytest-asyncio