Files
Bharat Shetty BarkurandClaude Opus 4.5 f350c4bd78 Fix CI test failures by making storymem_src a proper package
- Add __init__.py to storymem_src to make it importable as a Python package
- Fix test_decord_optional_import to handle missing dependencies gracefully
- Test now skips when heavy dependencies (cv2, einops, clip) aren't installed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 18:48:04 +05:30
..

Tests for Comfyui_StoryMem

This directory contains tests to verify the custom nodes work correctly.

Running Tests Locally

Install test dependencies

pip install -r tests/requirements-test.txt

Install core dependencies

pip install torch torchvision numpy pillow easydict typing_extensions

Run all tests

pytest tests/ -v

Run specific test file

pytest tests/test_imports.py -v

Run with coverage

pytest tests/ --cov=storymem_wrapper --cov-report=html

Test Structure

test_imports.py

Tests for issue #3 - Import errors preventing module loading:

  • TestImports: Verifies all imports work correctly

    • test_keyframe_extractor_imports: Tests Dict and Any imports in keyframe_extractor.py
    • test_storymem_bridge_imports: Tests WanTI2V import (not WanMI2V) in storymem_bridge.py
    • test_typing_imports_available: Verifies typing module is available
    • test_analyze_frame_diversity_signature: Tests method with Dict[str, Any] return type
  • TestModuleStructure: Tests module organization

    • test_storymem_wrapper_exists: Verifies all wrapper modules exist
    • test_no_syntax_errors: Checks Python syntax in all files

CI/CD Integration

The tests run automatically on:

  • Push to main/master branches
  • Push to fix/** branches
  • Pull requests to main/master

See .github/workflows/test.yml for the full CI configuration.

Test Philosophy

These tests focus on:

  1. Import correctness: Ensuring no NameError or ImportError from missing types
  2. Syntax validation: All Python files compile without errors
  3. Module structure: Core wrapper modules are present and loadable

The tests are designed to pass even when optional dependencies (like the full StoryMem source) are not available, making them suitable for CI environments.