RTS3D icon indicating copy to clipboard operation
RTS3D copied to clipboard

feat: set up comprehensive Python testing infrastructure

Open llbbl opened this issue 3 months ago • 0 comments

Set up comprehensive Python testing infrastructure

Summary

This PR establishes a complete testing infrastructure for the RTS3D project, providing developers with a ready-to-use environment for writing and running tests.

Changes Made

  • Package Management: Set up Poetry as the package manager with pyproject.toml configuration
  • Dependency Migration: Migrated existing dependencies from requirements.txt to Poetry format
  • Testing Dependencies: Added pytest, pytest-cov, and pytest-mock as development dependencies
  • Test Configuration: Configured comprehensive pytest settings including:
    • Custom test markers: unit, integration, slow
    • Coverage reporting with 80% threshold
    • HTML and XML coverage report generation
    • Strict configuration for reliable test runs
  • Directory Structure: Created organized test directories:
    • tests/ - Main test directory
    • tests/unit/ - Unit tests
    • tests/integration/ - Integration tests
  • Shared Fixtures: Added comprehensive conftest.py with fixtures for:
    • Temporary directories and files
    • Mock models and configurations
    • Sample KITTI data structures
    • Environment cleanup
  • Infrastructure Validation: Created validation test suite to verify setup
  • Git Configuration: Updated .gitignore with testing artifacts and Claude Code settings

Running Tests

Basic Commands

# Install dependencies
poetry install

# Run all tests
poetry run pytest

# Run tests with coverage
poetry run pytest --cov=src --cov-report=html

# Run specific test types
poetry run pytest -m unit          # Unit tests only
poetry run pytest -m integration   # Integration tests only
poetry run pytest -m slow          # Slow tests only

Coverage Reports

  • HTML reports: htmlcov/index.html
  • XML reports: coverage.xml
  • Console output with missing line numbers

Configuration Notes

  • Python Version: Requires Python 3.8+
  • Coverage Threshold: Set to 80% (configurable in pyproject.toml)
  • Excluded from Coverage: External libraries, setup files, CUDA extensions
  • Test Discovery: Follows pytest conventions (test_*.py, *_test.py)

Next Steps

Developers can now:

  1. Write unit tests in tests/unit/
  2. Write integration tests in tests/integration/
  3. Use shared fixtures from conftest.py
  4. Run tests with coverage reporting
  5. Use custom markers to organize test execution

The validation tests confirm all infrastructure components are working correctly.

llbbl avatar Sep 04 '25 13:09 llbbl