You've already forked FrameTour-RenderWorker
q
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""pytest配置文件"""
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import tempfile
|
||||
@@ -7,7 +8,7 @@ from pathlib import Path
|
||||
from typing import Dict, Any
|
||||
|
||||
from entity.render_task import RenderTask
|
||||
from config.settings import Config
|
||||
from config.settings import FFmpegConfig, APIConfig, StorageConfig
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -19,14 +20,28 @@ def temp_dir():
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_config():
|
||||
"""测试用配置"""
|
||||
return Config(
|
||||
def test_ffmpeg_config():
|
||||
"""测试用FFmpeg配置"""
|
||||
return FFmpegConfig(
|
||||
encoder_args="-c:v h264",
|
||||
video_args="",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_api_config():
|
||||
"""测试用API配置"""
|
||||
return APIConfig(
|
||||
endpoint="http://test.local",
|
||||
access_key="test_key",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_storage_config():
|
||||
"""测试用存储配置"""
|
||||
return StorageConfig(
|
||||
template_dir="tests/test_data/templates",
|
||||
api_endpoint="http://test.local",
|
||||
access_key="test_key"
|
||||
)
|
||||
|
||||
|
||||
@@ -41,7 +56,7 @@ def sample_render_task():
|
||||
effects=["zoom:0,2.0,3.0", "ospeed:1.5"],
|
||||
ext_data={
|
||||
"posJson": '{"ltX": 100, "ltY": 100, "rbX": 200, "rbY": 200, "imgWidth": 300, "imgHeight": 300}'
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -57,6 +72,7 @@ def sample_video_file(temp_dir):
|
||||
def ffmpeg_available():
|
||||
"""检查FFmpeg是否可用"""
|
||||
import subprocess
|
||||
|
||||
try:
|
||||
subprocess.run(["ffmpeg", "-version"], capture_output=True, check=True)
|
||||
return True
|
||||
@@ -69,7 +85,7 @@ def mock_ext_data():
|
||||
"""模拟扩展数据"""
|
||||
return {
|
||||
"posJson": '{"ltX": 50, "ltY": 50, "rbX": 150, "rbY": 150, "imgWidth": 200, "imgHeight": 200}',
|
||||
"templateData": {"width": 1920, "height": 1080}
|
||||
"templateData": {"width": 1920, "height": 1080},
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +94,7 @@ def pytest_collection_modifyitems(config, items):
|
||||
"""根据FFmpeg可用性修改测试收集"""
|
||||
try:
|
||||
import subprocess
|
||||
|
||||
subprocess.run(["ffmpeg", "-version"], capture_output=True, check=True)
|
||||
ffmpeg_available = True
|
||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||
@@ -87,4 +104,4 @@ def pytest_collection_modifyitems(config, items):
|
||||
skip_ffmpeg = pytest.mark.skip(reason="FFmpeg not available")
|
||||
for item in items:
|
||||
if "integration" in item.keywords:
|
||||
item.add_marker(skip_ffmpeg)
|
||||
item.add_marker(skip_ffmpeg)
|
||||
|
||||
Reference in New Issue
Block a user