japanese/tests/conftest.py
panli 1f64c87d0e Initial commit: 日语词表清洗工具(任务化架构)
- 任务化清洗流程:Task/TaskManager + BatchProcessor 三方法
- 数据目录规范化:data/{db,sources,backup}
- CLI 入口移进包,注册 jclean 命令
- 工作流测试驱动(tests/test_cleaner_workflow.py)
- 40 测试通过
2026-08-19 15:04:18 +08:00

38 lines
830 B
Python

from pathlib import Path
import pytest
@pytest.fixture
def get_test_file_path():
"""
获取测试数据文件的绝对路径
Args:
relative_path (str): 相对于 tests/data/ 的文件路径
Returns:
Path: 绝对路径对象
"""
def _get_path(relative_path):
return (Path(__file__).parent / "data" / relative_path).resolve()
return _get_path
@pytest.fixture
def get_data_file_path():
"""
获取项目 data/ 目录下数据文件的绝对路径
Args:
relative_path (str): 相对于项目根 data/ 的文件路径,如 "db/vocabulary.txt"
Returns:
Path: 绝对路径对象
"""
def _get_path(relative_path):
return (Path(__file__).parent.parent / "data" / relative_path).resolve()
return _get_path