feat: Set up comprehensive Python testing infrastructure with Poetry #116
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 VideoMamba project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and running tests with proper coverage reporting and development tooling.
Changes Made
Package Management Migration
pyproject.tomlwith Poetry configurationrequirements.txtto Poetry^3.9for compatibility with TensorFlowTesting Framework Setup
pytest(^8.1.1) - Main testing frameworkpytest-cov(^5.0.0) - Coverage reportingpytest-mock(^3.14.0) - Mocking utilitiespytest-xdist(^3.6.1) - Parallel test executionpytest-timeout(^2.3.1) - Test timeout managementTesting Configuration
pytest Configuration:
test_*.pyand*_test.pyunit,integration,slow,gpuCoverage Configuration:
Directory Structure
Shared Fixtures (conftest.py)
temp_dir- Temporary directory with automatic cleanupsample_config/omega_config- Configuration objectsmock_video_tensor/mock_image_tensor- Test tensorsdevice- PyTorch device selectionmock_checkpoint- Test checkpoint filesmock_dataset_root- Mock dataset structureDevelopment Tools
Updated .gitignore
Added entries for:
.pytest_cache/,htmlcov/,coverage.xml).claude/*)poetry.lockis intentionally tracked for reproducibilityHow to Use
Install Dependencies
Run Tests
Both commands are available:
Run with Coverage
Run Specific Test Types
Run Validation Tests
Notes
Optional Dependencies: Some dependencies (apex, decord, xformers) require special installation procedures and have been commented out. They can be installed separately as needed.
Coverage Threshold: Currently set to 0% to allow initial setup. This should be gradually increased as more tests are added.
Python Version: Set to Python 3.9+ due to TensorFlow requirements.
Testing Best Practices:
conftest.py@pytest.mark.unit, etc.)Next Steps