feat: add comprehensive Python testing infrastructure with Poetry #37
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.
Add Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the pysift project using Poetry for dependency management and pytest for testing.
Changes Made
1. Package Management
pyproject.toml
with project metadata and dependencies2. Testing Configuration
pytest Configuration:
unit
,integration
,slow
,performance
Coverage Configuration:
pysift
3. Testing Structure
4. Pytest Fixtures
Created comprehensive fixtures in
conftest.py
:temp_dir
: Temporary directory for test filessample_image
: Color test image (100x100)grayscale_image
: Grayscale test imagesample_keypoints
: OpenCV KeyPoint objectssample_descriptors
: Mock SIFT descriptorsmock_config
: Configuration dictionarytest_image_path
: Saved test image pathcapture_stdout
: Stdout capture utilitymock_sift_detector
: Mocked SIFT detector5. Poetry Scripts
Added convenient test commands:
poetry run test
- Run all tests with coveragepoetry run tests
- Alternative command (both work)6. Additional Changes
.gitignore
with comprehensive Python patternsHow to Use
Install dependencies:
Run tests:
Run specific test categories:
View coverage report:
# After running tests, open htmlcov/index.html in a browser
Notes
pyproject.toml
once unit tests are added.Next Steps
With this infrastructure in place, developers can now:
tests/unit/
tests/integration/