为视频生成 VR 双眼字幕的单体实现:FastAPI 后端、调度器与全部节点 (提音/转写/翻译/ASS/抽帧/OCR/LLM 过滤)在单进程内运行。 - 节点协议(wov_sdk 数据模型)与分布式版保持一致,预留回退桥梁 - 工作流即数据:DAG 存于 workflows/*.json,模型/链路改动只改数据 - 调度器:拓扑顺序执行、断点续跑(产物重建)、任务暂停/继续 - 抽帧按帧间隔(select 按帧号精确取帧),VLM OCR 与 LLM 过滤使用 自适应线程池弹性并发,并打印数据处理速度进度日志 - 100% 行覆盖率(pytest --cov-fail-under=100)
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""uvicorn 冒烟测试。
|
|
|
|
用真实套接字启动 uvicorn 服务并请求 /health,验证应用能脱离 TestClient
|
|
在实际 Web 服务环境中正常工作。
|
|
"""
|
|
|
|
import threading
|
|
import time
|
|
import urllib.request
|
|
|
|
from uvicorn import Config, Server
|
|
|
|
from wov_app.main import app
|
|
|
|
|
|
def test_uvicorn_serves_app_over_real_socket() -> None:
|
|
"""验证 uvicorn 监听真实端口后健康检查可用。"""
|
|
config = Config(app=app, host="127.0.0.1", port=0, log_level="error")
|
|
server = Server(config)
|
|
thread = threading.Thread(target=server.run, daemon=True)
|
|
thread.start()
|
|
try:
|
|
deadline = time.monotonic() + 10
|
|
while not server.started and time.monotonic() < deadline:
|
|
time.sleep(0.05)
|
|
assert server.started
|
|
|
|
port = server.servers[0].sockets[0].getsockname()[1]
|
|
with urllib.request.urlopen(f"http://127.0.0.1:{port}/health", timeout=5) as response:
|
|
assert response.status == 200
|
|
assert b'"wov-api"' in response.read()
|
|
finally:
|
|
server.should_exit = True
|
|
thread.join(timeout=10)
|