3DVideos2Stereo icon indicating copy to clipboard operation
3DVideos2Stereo copied to clipboard

feat: Set up comprehensive Python testing infrastructure

Open llbbl opened this issue 5 months ago • 0 comments

Set up Python Testing Infrastructure

Summary

This PR establishes a comprehensive testing infrastructure for the stereo imaging toolkit project. The setup includes Poetry for dependency management, pytest for testing, coverage reporting, and organized test directories.

Changes Made

Package Management

  • Configured Poetry as the package manager with pyproject.toml
  • Migrated dependencies including numpy, opencv-python, pillow, and imageio
  • Added development dependencies: pytest, pytest-cov, pytest-mock

Testing Configuration

  • pytest configuration with custom markers (unit, integration, slow)
  • Coverage settings with 80% threshold requirement
  • HTML and XML reporting for coverage analysis
  • Strict test discovery patterns and output formatting

Directory Structure

tests/
├── __init__.py
├── conftest.py          # Shared fixtures
├── unit/
│   └── __init__.py
├── integration/
│   └── __init__.py
└── test_setup_validation.py  # Validation tests

Shared Fixtures

Created comprehensive fixtures in conftest.py for:

  • Temporary directories and file management
  • Sample images and stereo pairs
  • Optical flow data
  • Mock command-line arguments
  • Disparity and uncertainty maps

Development Environment

  • Updated .gitignore with testing artifacts, IDE files, and project-specific entries
  • Coverage configuration excluding test files and virtual environments
  • Validation tests to verify infrastructure functionality

Running Tests

Basic Commands

# Install dependencies
poetry install

# Run all tests
poetry run pytest

# Run tests without coverage
poetry run pytest --no-cov

# Run specific test types
poetry run pytest -m unit
poetry run pytest -m integration
poetry run pytest -m slow

Coverage Reporting

# Generate HTML coverage report
poetry run pytest --cov-report=html

# View coverage in browser
open htmlcov/index.html

Test Results

✅ All validation tests pass (10/10)
✅ Coverage reporting configured and functional
✅ Custom markers working properly
✅ Shared fixtures operational

Notes

  • The project currently has 0% test coverage, which is expected as no unit tests exist yet for the main Python scripts
  • The infrastructure is ready for developers to immediately start writing tests
  • Coverage threshold is set to 80% but can be adjusted in pyproject.toml
  • Tests can be run with or without coverage reporting for faster development cycles

🤖 Generated with Claude Code

llbbl avatar Sep 02 '25 16:09 llbbl