adjust the resolution based on available VRAM. add elapsed time.
This commit is contained in:
@@ -8,7 +8,14 @@ from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from src.cli.main import app
|
||||
from src.cli.main import (
|
||||
app,
|
||||
align_resolution,
|
||||
align_num_frames,
|
||||
cap_resolution_for_backend,
|
||||
cap_num_frames_for_backend,
|
||||
format_duration,
|
||||
)
|
||||
|
||||
|
||||
runner = CliRunner()
|
||||
@@ -61,8 +68,8 @@ class TestValidateCommand:
|
||||
|
||||
result = runner.invoke(app, ["validate", str(storyboard_file)])
|
||||
assert result.exit_code == 0
|
||||
assert "valid" in result.output
|
||||
assert "Test Storyboard" in result.output
|
||||
assert "valid" in result.output
|
||||
assert "Test Storyboard" in result.output
|
||||
|
||||
def test_validate_verbose(self):
|
||||
"""Test validation with verbose flag."""
|
||||
@@ -82,7 +89,7 @@ class TestListBackendsCommand:
|
||||
"""Test listing available backends."""
|
||||
result = runner.invoke(app, ["list-backends"])
|
||||
assert result.exit_code == 0
|
||||
assert "wan" in result.output
|
||||
assert "wan_t2v_14b" in result.output
|
||||
assert "Available Backends" in result.output
|
||||
|
||||
|
||||
@@ -140,7 +147,7 @@ class TestResumeCommand:
|
||||
with patch('src.cli.main.CheckpointManager') as mock_mgr:
|
||||
mock_checkpoint = MagicMock()
|
||||
mock_checkpoint.storyboard_path = str(Path(tmpdir) / "storyboard.json")
|
||||
mock_mgr.return_value.get_project_checkpoint.return_value = mock_checkpoint
|
||||
mock_mgr.return_value.get_project.return_value = mock_checkpoint
|
||||
|
||||
# Create storyboard file
|
||||
storyboard_file = Path(tmpdir) / "storyboard.json"
|
||||
@@ -185,3 +192,52 @@ class TestCLIHelp:
|
||||
result = runner.invoke(app, ["resume", "--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "Resume a failed or interrupted project" in result.output
|
||||
|
||||
|
||||
class TestCLIAlignmentHelpers:
|
||||
"""Test CLI alignment helpers."""
|
||||
|
||||
def test_align_resolution_no_change(self):
|
||||
"""Resolution already aligned to 16."""
|
||||
width, height = align_resolution(1920, 1088)
|
||||
assert width == 1920
|
||||
assert height == 1088
|
||||
|
||||
def test_align_resolution_adjusts(self):
|
||||
"""Resolution is rounded up to multiple of 16."""
|
||||
width, height = align_resolution(1920, 1080)
|
||||
assert width == 1920
|
||||
assert height == 1088
|
||||
|
||||
def test_align_num_frames_no_change(self):
|
||||
"""Frame count already valid."""
|
||||
assert align_num_frames(97) == 97 # 97 - 1 is divisible by 4
|
||||
|
||||
def test_align_num_frames_adjusts(self):
|
||||
"""Frame count is rounded up to valid value."""
|
||||
assert align_num_frames(96) == 97
|
||||
|
||||
def test_cap_resolution_for_small_backend(self):
|
||||
"""Smaller backend caps resolution."""
|
||||
width, height = cap_resolution_for_backend("wan_t2v_1_3b", 1920, 1080)
|
||||
assert width == 1280
|
||||
assert height == 720
|
||||
|
||||
def test_cap_resolution_for_other_backends(self):
|
||||
"""No cap for other backends."""
|
||||
width, height = cap_resolution_for_backend("wan_t2v_14b", 1920, 1080)
|
||||
assert width == 1920
|
||||
assert height == 1080
|
||||
|
||||
def test_cap_num_frames_for_small_backend(self):
|
||||
"""Smaller backend caps frame count."""
|
||||
assert cap_num_frames_for_backend("wan_t2v_1_3b", 121) == 97
|
||||
|
||||
def test_cap_num_frames_for_other_backends(self):
|
||||
"""No cap for other backends."""
|
||||
assert cap_num_frames_for_backend("wan_t2v_14b", 121) == 121
|
||||
|
||||
def test_format_duration(self):
|
||||
"""Format duration for display."""
|
||||
assert format_duration(5) == "0m05s"
|
||||
assert format_duration(65) == "1m05s"
|
||||
|
||||
Reference in New Issue
Block a user