ARKitScenes
ARKitScenes copied to clipboard
feat: Set up comprehensive Python testing infrastructure
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the depth upsampling and 3D object detection Python project. It modernizes the dependency management and creates a foundation for robust test-driven development.
Changes Made
Package Management
- Migrated to Poetry: Replaced manual dependency management with Poetry
- Consolidated dependencies: Merged requirements from
depth_upsampling/requirements.txtandthreedod/requirements.txtintopyproject.toml - Added testing dependencies: pytest, pytest-cov, and pytest-mock as development dependencies
Testing Configuration
- Created
pyproject.tomlwith complete testing configuration:- Pytest settings with strict markers and configurations
- Coverage requirements set to 80% threshold
- Test discovery patterns for
test_*.pyand*_test.py - Custom markers:
unit,integration, andslow - Coverage reporting in multiple formats (terminal, HTML, XML)
Test Structure
- Created organized test directory:
tests/ ├── __init__.py ├── conftest.py ├── test_setup_validation.py ├── unit/ │ └── __init__.py └── integration/ └── __init__.py
Pytest Fixtures
Created comprehensive fixtures in conftest.py:
- General fixtures:
temp_dir,mock_config,capture_logs - Image/Vision fixtures:
sample_image,sample_depth_map,sample_point_cloud - PyTorch fixtures:
sample_torch_tensor,mock_model,mock_dataset,mock_dataloader - 3D Detection fixtures:
sample_bounding_boxes,sample_lidar_data - Environment fixtures:
reset_environment(auto-use)
Development Commands
Configured Poetry scripts for running tests:
poetry run test- Run all testspoetry run tests- Alternative command (both work)
Additional Updates
- Updated
.gitignore: Added testing artifacts, coverage reports, and Claude settings - Created validation tests: Comprehensive tests to verify the infrastructure works correctly
Instructions for Running Tests
-
Install dependencies:
poetry install -
Run all tests:
poetry run testor
poetry run tests -
Run specific test markers:
poetry run pytest -m unit # Run only unit tests poetry run pytest -m integration # Run only integration tests poetry run pytest -m "not slow" # Skip slow tests -
View coverage report:
- Terminal: Automatically shown after test run
- HTML: Open
htmlcov/index.htmlin a browser - XML: Available at
coverage.xmlfor CI integration
Notes
- The infrastructure is ready for immediate use - developers can start writing tests in the appropriate directories
- Coverage threshold is set to 80% to encourage comprehensive testing
- OpenCV may show import warnings in headless environments due to missing GUI libraries - this is handled in the validation tests
- The
rawdirectory was excluded from package configuration as it's not a proper Python package