mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-11-03 20:02:24 +01:00
test(duty-cycle): run the suite against an older openhop_core too
The tests that cover per-channel metering ask a fabric which radio will carry a packet, which an openhop_core from before the selector change cannot answer. Run against one, fourteen of them failed -- on a repeater whose whole point is that the core change is optional. Tests that genuinely need the newer core (they drive build_radio_stack through a real FabricRadio) are skipped when it is absent. The engine tests instead use a fabric double that implements core's resolve rule and nothing else: explicit radio_id wins, then the selector, then default_radio. That keeps the engine measured against the contract rather than against a convenience, and the real RFFabric is still what runs wherever the installed core supports it. One fan-out test asserted the engine names the egress radio. What must not change is which radio transmits; whether the engine names it or leaves the choice to the fabric depends on the core underneath, so it accepts either. Against openhop_core c95a684: 2154 pass, 6 skipped. Against dev with the selector change: 2157 pass, 3 skipped.
This commit is contained in:
1 parent
d6f1a4c73b
commit
42e7939447
3 files changed
+74
-12
No files matched your search
@@ -15,6 +15,18 @@ from repeater.config import (
|
||||
)
|
||||
|
||||
|
||||
def _core_selects_by_ingress() -> bool:
|
||||
from openhop_core.rf_fabric import RFFabric
|
||||
|
||||
return fabric_selects_by_ingress_radio(RFFabric())
|
||||
|
||||
|
||||
needs_ingress_core = pytest.mark.skipif(
|
||||
not _core_selects_by_ingress(),
|
||||
reason="installed openhop_core does not pass a packet's ingress radio to the TX selector",
|
||||
)
|
||||
|
||||
|
||||
class _FakeRadio:
|
||||
def __init__(self, name="r"):
|
||||
self.name = name
|
||||
@@ -126,6 +138,7 @@ def test_build_radio_stack_multi_wraps_fabric():
|
||||
assert radio.fabric._tx_selector is not None
|
||||
|
||||
|
||||
@needs_ingress_core
|
||||
@pytest.mark.asyncio
|
||||
async def test_sticky_tx_uses_the_packets_own_ingress_radio():
|
||||
a = _FakeRadio("a")
|
||||
@@ -194,6 +207,7 @@ def test_tx_mode_all_rejected():
|
||||
build_radio_stack(cfg)
|
||||
|
||||
|
||||
@needs_ingress_core
|
||||
@pytest.mark.asyncio
|
||||
async def test_bridge_tx_crosses_to_other_radio():
|
||||
"""RX on local -> TX on link; RX on link -> TX on local."""
|
||||
@@ -423,6 +437,7 @@ def test_an_older_core_keeps_the_behaviour_it_always_had():
|
||||
assert fabric.selector(b"frame") == "local"
|
||||
|
||||
|
||||
@needs_ingress_core
|
||||
def test_a_current_core_is_given_the_selector_that_routes_by_ingress_radio():
|
||||
from openhop_core.rf_fabric import RFFabric
|
||||
|
||||
|
||||
Reference in new issue
Block a user