feat: Set up comprehensive Python testing infrastructure#44
Open
llbbl wants to merge 1 commit intoTencent-Hunyuan:mainfrom
Open
feat: Set up comprehensive Python testing infrastructure#44llbbl wants to merge 1 commit intoTencent-Hunyuan:mainfrom
llbbl wants to merge 1 commit intoTencent-Hunyuan:mainfrom
Conversation
- Add Poetry package manager with pyproject.toml configuration - Configure pytest with coverage, markers, and custom settings - Create test directory structure with unit/integration organization - Add comprehensive shared fixtures in conftest.py - Update .gitignore with testing and build artifacts - Add validation tests to verify infrastructure setup - Configure Poetry scripts for 'test' and 'tests' commands - Make models directory a proper Python package
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.
Add Python Testing Infrastructure
Summary
This PR sets up a comprehensive testing infrastructure for the InstantCharacter project, providing all the necessary tooling and configuration for developers to write and run tests effectively.
Changes Made
Package Management
pyproject.tomlwith:pytest,pytest-cov,pytest-mock)Testing Configuration
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowProject Structure
models/directory a proper Python package with__init__.pyShared Fixtures (conftest.py)
Comprehensive fixtures for common testing needs:
temp_dir- Temporary directory managementmock_image- PIL Image mocksmock_tensor_image,mock_latents- PyTorch tensor mocksmock_config,mock_pipeline_config- Configuration mocksmock_model_components- Model component mocksmock_huggingface_hub- HuggingFace Hub download mockscapture_stdout- Output capture for testing print statementsbenchmark_timer- Simple performance benchmarkingAll fixtures gracefully handle missing optional dependencies.
Development Experience
poetry run testandpoetry run testswork.gitignorewith comprehensive Python/testing patternsHow to Use
Install dependencies (if Poetry is available):
Run tests:
Run with coverage:
Run validation tests:
Notes
Next Steps
Developers can now:
tests/unit/tests/integration/The testing infrastructure is ready for immediate use!