feat(music-lab): pipeline 5개 DB 테이블 + 헬퍼
YouTube 음악 파이프라인 Task 1 — 신규 5개 테이블과 헬퍼 함수 추가. 테이블: - video_pipelines: 파이프라인 단위 상태 머신 + 메타/리뷰 JSON - pipeline_jobs: 단계별 비동기 작업 상태/시간 - pipeline_feedback: 텔레그램 피드백 이력 - youtube_oauth_tokens: 채널 OAuth refresh/access 토큰 - youtube_setup: 단일 행 설정 (메타 템플릿/커버 프롬프트/리뷰 가중치/임계값/비주얼/공개정책) 헬퍼: - create_pipeline / get_pipeline / update_pipeline_state / list_pipelines - increment_feedback_count / record_feedback / get_feedback_history - create_pipeline_job / update_pipeline_job / list_pipeline_jobs - get_youtube_setup / update_youtube_setup - upsert_oauth_token / get_oauth_token / delete_oauth_token 테스트: - tests/test_pipeline_db.py: 7개 테스트 (생성/상태/피드백/잡/셋업/OAuth) - tests/conftest.py: freezegun 기반 freezer fixture 추가 - requirements.txt: freezegun>=1.4 추가 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,36 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tmp_db(tmp_path, monkeypatch):
|
||||
db_path = str(tmp_path / "test_music.db")
|
||||
monkeypatch.setattr("app.db.DB_PATH", db_path)
|
||||
return db_path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def freezer():
|
||||
"""Minimal freezegun-based fixture providing `move_to(time)` to mimic
|
||||
pytest-freezer's `freezer` fixture using only the `freezegun` package."""
|
||||
from freezegun import freeze_time
|
||||
|
||||
class _Freezer:
|
||||
def __init__(self):
|
||||
self._ctx = None
|
||||
|
||||
def move_to(self, target):
|
||||
if self._ctx is not None:
|
||||
self._ctx.stop()
|
||||
self._ctx = freeze_time(target)
|
||||
self._ctx.start()
|
||||
|
||||
def stop(self):
|
||||
if self._ctx is not None:
|
||||
self._ctx.stop()
|
||||
self._ctx = None
|
||||
|
||||
f = _Freezer()
|
||||
try:
|
||||
yield f
|
||||
finally:
|
||||
f.stop()
|
||||
|
||||
Reference in New Issue
Block a user