Set up Python testing infrastructure with Poetry and pytest #127
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
validate_emailPython project using Poetry for package management and pytest as the testing framework.Changes Made
Package Management
pyproject.tomlwith complete project metadata migrated fromsetup.pypytest(^8.0.0) - Core testing frameworkpytest-cov(^5.0.0) - Coverage reportingpytest-mock(^3.14.0) - Mocking utilitiesTesting Configuration
pytest Configuration:
test_*.pyand*_test.pyfilesunit,integration, andslowCoverage Configuration:
validate_emailmoduleDirectory Structure
Shared Fixtures (conftest.py)
temp_dir: Temporary directory for test filesmock_email_config: Mock email configuration datamock_dns_resolver: Mock DNS resolver for MX lookupsmock_smtp_connection: Mock SMTP connectionsample_mx_records: Sample MX record datanetwork_timeout: Standard timeout valuetest_data_dir: Path to test data directoryDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative command (both work)Additional Updates
.gitignorewith:.pytest_cache/,.coverage,htmlcov/, etc.)poetry.lockfrom gitignore as recommended).claude/*)How to Use
Install dependencies:
Run tests:
Run specific test categories:
Generate coverage reports:
htmlcov/index.htmlcoverage.xmlNotes