32 lines
861 B
Python
32 lines
861 B
Python
"""Общие фикстуры pytest."""
|
||
|
||
from __future__ import annotations
|
||
|
||
import pytest
|
||
|
||
from voice_dictation.core.paths import AppPaths
|
||
|
||
|
||
@pytest.fixture()
|
||
def tmp_paths(tmp_path: pytest.TempPathFactory) -> AppPaths:
|
||
"""AppPaths с временными директориями в pytest tmp_path.
|
||
|
||
Args:
|
||
tmp_path: Встроенная фикстура pytest.
|
||
|
||
Returns:
|
||
AppPaths с путями в tmp_path.
|
||
"""
|
||
root = tmp_path # type: ignore[arg-type]
|
||
paths = AppPaths(
|
||
root=root,
|
||
config_file=root / "config.json",
|
||
usage_db=root / "usage.db",
|
||
dictionary_file=root / "dictionary.txt",
|
||
custom_sounds_dir=root / "sounds",
|
||
log_file=root / "app.log",
|
||
pid_file=root / "dictate.pid",
|
||
tmp_dir=root / "tmp",
|
||
)
|
||
paths.ensure_exists()
|
||
return paths
|