- synthgen/config.py: Config, load_config (YAML + --set), dump_config, проверки диапазонов §3 - synthgen/rng.py: rng_for (SHA-256 → Random), stable_hash - synthgen/__main__.py: разбор --config/--set/--out/--force, ошибка конфигурации → код 2 - synthgen/examples/default.yaml: все ключи §3 со значениями по умолчанию - копии из synthetic-group/gen (#35): inn, xlsx, ledger, chart (+80.09, 91.09 из seed arm-core) - тесты: config, inn, ledger; conftest с маркерами parser/slow - .gitignore: out/ - спека: решения 15–16 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""Общие настройки pytest для synthgen.
|
||
|
||
Маркеры:
|
||
- `parser` — приёмка парсером tabular-parser из зеркального worktree (переменная `TP_WT`);
|
||
без окружения такие тесты пропускаются.
|
||
- `slow` — долгие прогоны; по умолчанию пропускаются, запуск: `-m slow`.
|
||
"""
|
||
|
||
import os
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
|
||
def pytest_configure(config):
|
||
config.addinivalue_line("markers", "parser: приёмка парсером из зеркального worktree (TP_WT), без окружения — skip")
|
||
config.addinivalue_line("markers", "slow: долгий прогон, по умолчанию пропускается, запуск -m slow")
|
||
|
||
|
||
def pytest_collection_modifyitems(config, items):
|
||
markexpr = config.getoption("-m") or ""
|
||
tp_wt = os.environ.get("TP_WT")
|
||
parser_ready = bool(tp_wt) and Path(tp_wt).is_dir()
|
||
for item in items:
|
||
if "slow" in item.keywords and "slow" not in markexpr:
|
||
item.add_marker(pytest.mark.skip(reason="долгий прогон: запуск с -m slow"))
|
||
if "parser" in item.keywords and not parser_ready:
|
||
item.add_marker(pytest.mark.skip(reason="нужен TP_WT (зеркало tabular-parser)"))
|