feat: Add comprehensive Python testing infrastructure with Poetry #62
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 sets up a complete testing infrastructure for the Video Depth Anything project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and maintaining tests throughout the project.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetrydecordas optional due to platform-specific installation issuesTesting Configuration
pytest Configuration: Comprehensive setup in
pyproject.tomlincluding:test_*.pyand*_test.pyunit,integration,slowCoverage Configuration:
video_depth_anything,metric_depth,benchmark,utilsDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive fixtures for common testing scenarios:
temp_dir: Temporary directory managementsample_image_path: Test image generationsample_video_path: Mock video file pathssample_tensor: PyTorch tensor fixturessample_depth_map: Depth map test datamock_model_config&mock_dataset_config: Configuration fixturestorch_deterministic: Ensures reproducible PyTorch operationsgpu_available&skip_if_no_gpu: GPU testing utilitiesAdditional Setup
Updated .gitignore: Added entries for:
.pytest_cache/,.coverage,htmlcov/,coverage.xml.claude/*poetry.lockis gitignored but should be removed from gitignore for productionValidation Tests: Created
test_setup_validation.pyto verify:Running Tests
After setting up the environment, developers can run tests using:
Notes
Coverage Threshold: Currently set to 0% to allow the infrastructure to be set up without requiring immediate test coverage. This should be gradually increased as tests are added.
Decord Package: Marked as optional due to platform-specific installation issues. If needed for testing, it can be installed separately.
Poetry Lock File: Currently gitignored for flexibility during development. For production, remove
poetry.lockfrom.gitignoreto ensure reproducible builds.Next Steps:
Testing the Setup
The validation tests have been run successfully, confirming:
poetry run testandpoetry run testscommands workThis infrastructure is now ready for developers to start writing comprehensive tests for the Video Depth Anything project.