feat: Set up comprehensive Python testing infrastructure with Poetry #12
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 drymail project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.toml
with all project metadata and dependenciesmistune
andbeautifulsoup4
from requirements.txtpytest
- Core testing frameworkpytest-cov
- Coverage reporting pluginpytest-mock
- Mocking utilitiesTesting Configuration
Pytest configuration in
pyproject.toml
:test_*.py
and*_test.py
filesunit
,integration
, andslow
Coverage configuration:
drymail
moduleDirectory Structure
Shared Fixtures (conftest.py)
temp_dir
- Temporary directory for test filesmock_smtp_server
- Mock SMTP server for email testingmock_email_config
- Sample email configurationsample_email_data
- Test email datamock_attachment
- File attachment mocktemp_file
- Helper to create temporary filesreset_environment
- Auto-cleanup of environment variablescapture_logs
- Log capture utilityAdditional Updates
How to Use
Install Dependencies
Running Tests
Writing Tests
tests/unit/
tests/integration/
conftest.py
@pytest.mark.unit
,@pytest.mark.integration
,@pytest.mark.slow
Notes
requirements.txt
andsetup.py
are preserved for backward compatibility.venv/
automaticallyValidation
The infrastructure has been validated with a comprehensive test suite (
test_infrastructure_validation.py
) that verifies: