23 lines
457 B
Python
23 lines
457 B
Python
|
|
"""pytest 配置和共享 fixtures"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from minenasai.core import reset_settings
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture(autouse=True)
|
||
|
|
def reset_global_settings():
|
||
|
|
"""每个测试后重置全局配置"""
|
||
|
|
yield
|
||
|
|
reset_settings()
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def temp_config(tmp_path):
|
||
|
|
"""创建临时配置目录"""
|
||
|
|
config_dir = tmp_path / ".config" / "minenasai"
|
||
|
|
config_dir.mkdir(parents=True)
|
||
|
|
return config_dir
|