feat: Set up comprehensive Python testing infrastructure with Poetry #48
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.
Set up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the Python project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and running tests with coverage reporting and organized test structure.
Changes Made
Package Management
pyproject.toml
with Poetry configuration as the project's package managerTesting Configuration
pytest Settings: Configured pytest with:
Coverage Settings: Set up coverage.py with:
Directory Structure
Shared Fixtures (conftest.py)
Created comprehensive pytest fixtures including:
temp_dir
: Temporary directory creation and cleanupmock_config
: Sample configuration dictionarysample_data
: Test data structuresmock_json_file
,mock_text_file
,mock_python_file
: File creation helpersenv_vars
: Environment variable managementcapture_logs
: Log capture utilitycleanup_test_files
: Automatic test file cleanupAdditional Setup
.gitignore
with testing artifacts and Claude settingsRunning Tests
To run tests, use the following command:
Additional pytest options are available:
poetry run pytest -v
- Verbose outputpoetry run pytest tests/unit/
- Run only unit testspoetry run pytest -m integration
- Run only integration testspoetry run pytest --cov-report=html
- Generate HTML coverage reportDependencies Added
Notes
poetry.lock
) should be committed to version control for reproducible builds--cov-fail-under=80
to pytest options