feat: Set up comprehensive Python testing infrastructure#30
Open
llbbl wants to merge 1 commit intoPhantom-video:mainfrom
Open
feat: Set up comprehensive Python testing infrastructure#30llbbl wants to merge 1 commit intoPhantom-video:mainfrom
llbbl wants to merge 1 commit intoPhantom-video:mainfrom
Conversation
- Add Poetry for dependency management with pyproject.toml - Configure pytest with coverage, markers, and custom settings - Add testing dependencies (pytest, pytest-cov, pytest-mock, etc.) - Create tests directory structure with unit/integration folders - Add comprehensive conftest.py with reusable fixtures - Create validation tests to verify infrastructure setup - Update .gitignore with testing and Claude-related entries - Make flash-attn optional for CPU environments
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 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: