23 lines
938 B
Python
23 lines
938 B
Python
"""Shared fixtures keep unrelated queue tests independent of the wall clock."""
|
||
import json
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
|
||
@pytest.fixture
|
||
def all_day_gpu_policy(monkeypatch):
|
||
"""非时段测试显式使用临时全天配置,仍运行真实Store和准入逻辑。"""
|
||
from llm_services.store import Store
|
||
original_init = Store.__init__
|
||
|
||
def initialize_with_policy(store, path, *, policy_file=None):
|
||
policy_file = Path(policy_file) if policy_file is not None else Path(path).parent / 'all-day-runtime-policy.json'
|
||
policy_file.parent.mkdir(parents=True, exist_ok=True)
|
||
if not policy_file.exists():
|
||
policy_file.write_text(json.dumps({'schema_version': 1,
|
||
'batch_window_enabled': False, 'workflow_max_shots': 120}), encoding='utf-8')
|
||
original_init(store, path, policy_file=policy_file)
|
||
|
||
monkeypatch.setattr(Store, '__init__', initialize_with_policy)
|