Set up comprehensive Python testing infrastructure with Poetry#21
Open
llbbl wants to merge 1 commit into3DTopia:mainfrom
Open
Set up comprehensive Python testing infrastructure with Poetry#21llbbl wants to merge 1 commit into3DTopia:mainfrom
llbbl wants to merge 1 commit into3DTopia:mainfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Create test directory structure (tests/, unit/, integration/) - Configure pytest with coverage reporting and custom markers - Add comprehensive shared fixtures in conftest.py - Update .gitignore with testing and Poetry entries - Create validation tests to verify infrastructure setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 DVA-MVP Python project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetrypytest(^8.0.0) - Main testing frameworkpytest-cov(^5.0.0) - Coverage reportingpytest-mock(^3.14.0) - Mocking utilitiespillow(^10.0.0) - Image handling for test fixturesTesting Configuration
pyproject.tomlwith:test_*.pyand*_test.pyfilesunit,integration, andslowdva,models,datasets, andutilsmodulesDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive fixtures for common testing needs:
temp_dir- Temporary directory managementsample_config- Mock OmegaConf configurationmock_tensor_data- PyTorch tensor test datamock_numpy_data- NumPy array test datasample_image_path- Test image file creationsample_mesh_data- 3D mesh test datadevice- PyTorch device selectionreset_random_seeds- Reproducible test runsmock_model_weights- Mock model checkpoint filesenvironment_variables- Temporary environment variable managementAdditional Configuration
.gitignorewith:.pytest_cache/,.coverage,htmlcov/, etc.).vscode/,.idea/, etc.).claude/*)poetry.lockis NOT ignored as it should be committedValidation
poetry run testandpoetry run testscommands are configuredHow to Use
Install dependencies:
Run all tests:
Run tests with specific markers:
Run tests with coverage:
View coverage reports:
open htmlcov/index.htmlcoverage.xml(for CI integration)Notes
>=3.9,<3.12due to dependency requirementsNext Steps
Developers can now start writing tests for the codebase using the established infrastructure. The validation tests serve as examples of how to use the various fixtures and testing features.