CloudMind AI - Tests
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:
- Place unit tests in
tests/unit/ - Place integration tests in
tests/integration/ - Follow the naming convention:
test_*.py - Use pytest fixtures for reusable test data
- 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