feat: Set up comprehensive Python testing infrastructure #40
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 comprehensive Python testing infrastructure
Summary
This PR establishes a complete testing infrastructure for the PDF Compressor project, migrating from a simple
requirements.txtsetup to a professional Poetry-based development environment with comprehensive testing capabilities.Changes Made
requirements.txtto Poetry withpyproject.tomlconfigurationpytest,pytest-cov, andpytest-mockas development dependenciesunit,integration, andslowtestsconftest.pywith reusable test fixtures:temp_dir: Temporary directory for test filessample_pdf_path: Mock PDF files for testingmock_qapplication: PyQt application mockingmock_subprocess: Subprocess command mockingcompression_test_data: Test data for compression operations.gitignorewith testing-related entries and IDE configurationsTesting Infrastructure Components
pytest Configuration (
pyproject.toml):Coverage Configuration:
src/)Shared Test Fixtures (
tests/conftest.py):Running Tests
After this setup, developers can run tests using:
Coverage Reports
The setup generates coverage reports in multiple formats:
htmlcov/index.html- Interactive coverage reportcoverage.xml- For CI/CD integrationDependencies Migration
Before:
requirements.txtAfter:
pyproject.tomlwith PoetryPyQt6,humanizepytest,pytest-cov,pytest-mockNext Steps
This infrastructure is ready for developers to:
The validation tests confirm that all fixtures, markers, and coverage reporting work correctly. The setup follows Python testing best practices and provides a solid foundation for comprehensive test coverage.