Skip to content

Conversation

llbbl
Copy link

@llbbl llbbl commented Sep 2, 2025

Set up Python Testing Infrastructure

Summary

This PR establishes a comprehensive testing infrastructure for the GEPP project using Poetry as the package manager and pytest as the testing framework.

🔧 Infrastructure Components Added

  • Poetry Configuration: Set up pyproject.toml with Poetry as package manager

    • Migrated all dependencies from requirements.txt
    • Added testing dependencies as development group
    • Fixed version compatibility issues between Jinja2 and MarkupSafe
  • Testing Framework: Configured pytest with comprehensive settings

    • Custom markers for unit, integration, and slow tests
    • Coverage reporting with 80% threshold requirement
    • HTML and XML coverage report generation
    • Strict configuration for consistent test behavior
  • Directory Structure: Created organized testing layout

    tests/
    ├── __init__.py
    ├── conftest.py          # Shared fixtures
    ├── unit/
    │   └── __init__.py
    ├── integration/
    │   └── __init__.py
    └── test_infrastructure.py  # Validation tests
    
  • Shared Fixtures: Comprehensive conftest.py with common testing utilities

    • Temporary directory management
    • Mock Docker client and Git repository
    • Sample configurations and requirements
    • Environment variable cleanup

🧪 Testing Commands

Run tests using Poetry:

# Run all tests
poetry run pytest

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

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

✅ Validation

  • All 15 infrastructure validation tests pass
  • Dependencies successfully installed and compatible
  • Coverage reporting generates HTML and XML outputs
  • Testing directory structure properly configured
  • Fixtures and markers working as expected

📝 Additional Changes

  • Updated .gitignore with Claude Code settings (.claude/*)
  • All testing-related entries already present in existing .gitignore
  • Poetry lock file created but not added to .gitignore as requested

🚀 Ready for Development

The testing infrastructure is now ready for developers to start writing tests. The foundation provides:

  • Comprehensive fixture library for common testing scenarios
  • Organized structure separating unit and integration tests
  • Coverage tracking with reasonable thresholds
  • Flexible marker system for test categorization
  • Compatible dependency versions

Developers can immediately begin writing tests using the established patterns and fixtures.

- Configure Poetry as package manager with pyproject.toml
- Add pytest, pytest-cov, pytest-mock as test dependencies
- Create complete testing directory structure (tests/, unit/, integration/)
- Configure pytest with custom markers and coverage reporting (80% threshold)
- Add shared fixtures in conftest.py for common testing scenarios
- Create validation tests to verify infrastructure functionality
- Update .gitignore with testing and Claude Code entries
- Ensure compatibility between Jinja2 and MarkupSafe versions
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