Skip to content

Conversation

@llbbl
Copy link

@llbbl llbbl commented Sep 3, 2025

Set up Python Testing Infrastructure

Summary

This PR establishes a comprehensive testing infrastructure for the BESO project, providing developers with a ready-to-use testing environment.

Changes Made

  • Poetry Package Management: Set up Poetry as the package manager with pyproject.toml configuration
  • Testing Dependencies: Added essential testing packages:
    • pytest (main testing framework)
    • pytest-cov (coverage reporting)
    • pytest-mock (mocking utilities)
  • Directory Structure: Created organized testing directories:
    • tests/ (root test directory)
    • tests/unit/ (unit tests)
    • tests/integration/ (integration tests)
    • All with proper __init__.py files
  • Testing Configuration: Comprehensive pytest configuration in pyproject.toml:
    • Test discovery patterns
    • Coverage reporting (80% threshold, HTML/XML reports)
    • Custom markers (unit, integration, slow)
    • Strict testing options
  • Shared Fixtures: Rich conftest.py with common fixtures:
    • Temporary directories
    • Mock configurations
    • Sample data (observations, actions, trajectories)
    • PyBullet mocking for environment testing
  • Validation Tests: Comprehensive tests to verify the infrastructure works
  • Updated .gitignore: Added testing-related entries and Claude Code settings

How to Run Tests

# Install dependencies
poetry install

# Run all tests
poetry run pytest

# Run with verbose output
poetry run pytest -v

# Run only unit tests
poetry run pytest -m "unit"

# Run only integration tests  
poetry run pytest -m "integration"

# Run tests excluding slow ones
poetry run pytest -m "not slow"

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

Coverage Reporting

  • HTML Report: Generated in htmlcov/ directory
  • XML Report: Generated as coverage.xml
  • Terminal Report: Shows missing lines
  • Threshold: Set to 80% coverage requirement

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 categorize and filter tests

The infrastructure is fully validated and ready for immediate use.

🤖 Generated with Claude Code

- Add Poetry configuration with testing dependencies (pytest, pytest-cov, pytest-mock)
- Create complete testing directory structure with unit/integration subdirs
- Configure pytest with coverage reporting (80% threshold, HTML/XML output)
- Add custom test markers (unit, integration, slow) for test categorization
- Set up shared fixtures in conftest.py for common testing utilities
- Create validation tests to verify testing infrastructure works correctly
- Update .gitignore with testing-related entries and Claude Code settings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant