feat: Set up comprehensive Python testing infrastructure #30
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 Phantom-Wan video generation project. It transitions the project from simple pip-based dependency management to Poetry, and sets up a complete pytest-based testing framework ready for developers to write tests.
Changes Made
Package Management
pyproject.tomlwith all dependencies fromrequirements.txtflash-attnoptional for CPU environments via Poetry extrasTesting Framework
pytest(^8.0.0) - Core testing frameworkpytest-cov(^5.0.0) - Coverage reportingpytest-mock(^3.14.0) - Mocking utilitiespytest-xdist(^3.6.0) - Parallel test executionpytest-timeout(^2.3.0) - Test timeout managementTesting Configuration
pytest Configuration in
pyproject.toml:unit,integration,slow,gpu,networkCoverage Settings:
phantom_wanpackage__init__.py, virtual environmentsDirectory Structure
Shared Fixtures (conftest.py)
temp_dir: Temporary directory managementmock_config: Configuration dictionary for testingsample_image: Creates test imagessample_video_frames: Creates test video frame sequencesmock_torch_tensor,mock_numpy_array: Test datamock_model,mock_pipeline: Model/pipeline mocksenv_vars: Environment variable managementcapture_logs: Log capture for testinggpu_available: GPU availability checkDevelopment Tools
black,isort,flake8,mypypre-commitfor git hookspoetry run testandpoetry run testsUpdated .gitignore
.pytest_cache/,.coverage,htmlcov/, etc..claude/How to Use
Installation
Running Tests
Writing Tests
tests/unit/ortests/integration/conftest.pyfor common test needs@pytest.mark.unit,@pytest.mark.slow, etc.test_*.pyfor test filesNotes
flash-attnis optional and only installs with CUDA supportNext Steps
With this infrastructure in place, developers can now: