2025-10-31 15:23:24 +03:00
|
|
|
"""fixtures for tests"""
|
|
|
|
|
|
2025-10-21 22:33:34 +03:00
|
|
|
from pathlib import Path
|
2025-10-31 15:23:24 +03:00
|
|
|
import pytest
|
2025-10-21 22:33:34 +03:00
|
|
|
|
2025-10-31 15:23:24 +03:00
|
|
|
TEST_FILE = 'Documents/1C/1c-code-templates/Надулич.st'
|
2025-10-21 22:33:34 +03:00
|
|
|
|
2025-10-31 15:23:24 +03:00
|
|
|
@pytest.fixture(scope="class", name="test_file_path")
|
|
|
|
|
def test_data_path():
|
2025-10-21 22:33:34 +03:00
|
|
|
return Path.home() / TEST_FILE
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="class")
|
2025-10-31 15:23:24 +03:00
|
|
|
def test_data(test_file_path):
|
2025-10-21 22:33:34 +03:00
|
|
|
file_data = test_file_path.read_text(encoding='utf-8-sig')
|
|
|
|
|
return file_data
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="class")
|
|
|
|
|
def temp_src(tmp_path_factory):
|
|
|
|
|
"""
|
|
|
|
|
Создаёт временную папку 'src' для теста.
|
|
|
|
|
Папка автоматически удаляется после теста.
|
|
|
|
|
"""
|
|
|
|
|
return tmp_path_factory.mktemp("src")
|