mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-11 12:07:48 +01:00
Extracted and generalized from diet_guard's existing tombstone-merge scheme and GitHub Contents API client, extended with per-field HLC LWW so the same library can also cover todo's mutable notes and wake_alarm's single-value sync (Workstream D scoping decision, 2026-07-04). 100% branch coverage, clean ruff/mypy/pylint/bandit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017McuA1nAi6jBT1EaS5BrVf
23 lines
525 B
Python
23 lines
525 B
Python
"""Shared pytest fixtures for crdt_sync's test suite."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
import pytest
|
|
|
|
from crdt_sync import Hlc
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Callable
|
|
|
|
|
|
@pytest.fixture
|
|
def make_hlc() -> Callable[..., Hlc]:
|
|
"""Return a factory for deterministic Hlc values."""
|
|
|
|
def _make(wall_time_ms: int, counter: int = 0, node_id: str = "node-a") -> Hlc:
|
|
return Hlc(wall_time_ms=wall_time_ms, counter=counter, node_id=node_id)
|
|
|
|
return _make
|