from pathlib import Path import pytest from rf4_research.community_cli import enforce_fetch_interval, mark_fetch def test_fetch_cooldown_is_persistent_per_source(tmp_path: Path) -> None: state_file = tmp_path / "fetch-state.json" mark_fetch("rf4map-point", state_file=state_file, now=1_000) with pytest.raises(RuntimeError, match="retry in 1800 seconds"): enforce_fetch_interval("rf4map-point", state_file=state_file, now=1_000) enforce_fetch_interval("rf4posts-spot", state_file=state_file, now=1_000) enforce_fetch_interval("rf4map-point", state_file=state_file, now=2_800)