voice-dictation/tests/conftest.py
2026-10-19 14:30:58 +03:00

32 lines
861 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Общие фикстуры 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