feat: Set up comprehensive Python testing infrastructure with Poetry#22
Open
llbbl wants to merge 1 commit intodennlinger:masterfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#22llbbl wants to merge 1 commit intodennlinger:masterfrom
llbbl wants to merge 1 commit intodennlinger:masterfrom
Conversation
- Configured Poetry as package manager with updated dependencies - Added pytest with coverage, mocking, and parallel test support - Created organized test directory structure (unit/integration) - Set up shared fixtures and testing utilities in conftest.py - Configured pytest markers for test categorization - Added coverage reporting with HTML and XML output - Updated .gitignore with testing and development artifacts - Created validation tests to verify infrastructure setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python Testing Infrastructure Setup
Summary
This PR establishes a comprehensive testing infrastructure for the Python project, migrating from a simple
requirements.txtto a modern Poetry-based dependency management system with full pytest support.Changes Made
Package Management
requirements.txttopyproject.tomlpoetry.lockfor reproducible buildsTesting Framework
Directory Structure
Configuration (pyproject.toml)
pytest Settings:
unit,integration,slow,skip_ciCoverage Settings:
baselines,dataset,our_modelDevelopment Tools
Shared Fixtures (conftest.py)
temp_dir: Temporary directory managementsample_text_file,sample_csv_file,sample_json_file: Test file generationmock_config: Configuration mockingmock_model: Model object mockingcapture_logs: Log capture during testsmock_requests: HTTP request mockingbenchmark_timer: Simple performance timingHow to Use
Installation
# Install all dependencies including dev dependencies poetry installRunning Tests
Coverage Reports
After running tests, coverage reports are available in:
htmlcov/index.htmlcoverage.xml(for CI/CD integration)Writing New Tests
tests/unit/tests/integration/conftest.pyValidation
The infrastructure has been validated with 16 passing tests that verify:
Notes
poetry.lockfile should be committed to ensure reproducible builds.gitignorehas been updated to exclude all testing artifactsNext Steps
Developers can now immediately start writing tests for the codebase modules using this infrastructure. The validation tests serve as examples of how to use the fixtures and test patterns.