mirror of
https://github.com/l5yth/potato-mesh.git
synced 2026-10-31 03:51:58 +01:00
data: keep snapshot node ages when the radio clock is off (#1007)
* data: keep snapshot node ages when the radio clock is off * data: add the snapshot clock unit tests left out of the first commit
This commit is contained in:
9 files changed
+1327
-21
No files matched your search
@@ -17,7 +17,9 @@ from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -66,6 +68,23 @@ def permit_tx(monkeypatch):
|
||||
return config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def host_clock(monkeypatch, host_now):
|
||||
"""Drive the ingestor host clock by hand, starting at ``host_now``.
|
||||
|
||||
``host_now`` is a fixture the requesting test module defines, returning
|
||||
its start time in whole Unix seconds (the receive-time checks, SPEC
|
||||
RK1-RK4). The clock stays there until a test moves it.
|
||||
|
||||
Returns:
|
||||
A namespace whose ``now`` attribute :func:`time.time` returns.
|
||||
"""
|
||||
|
||||
clock = SimpleNamespace(now=host_now)
|
||||
monkeypatch.setattr(time, "time", lambda: float(clock.now))
|
||||
return clock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def load_config(monkeypatch):
|
||||
"""Reload :mod:`~data.mesh_ingestor.config` under the given environment.
|
||||
|
||||
Reference in new issue
Block a user