ecu-tests/tests/unit/test_hex_flasher.py

33 lines
860 B
Python

import pytest
from ecu_framework.flashing.hex_flasher import HexFlasher
from ecu_framework.lin.base import LinFrame
class _StubLin:
def __init__(self):
self.sent = []
def connect(self):
pass
def disconnect(self):
pass
def send(self, frame: LinFrame):
self.sent.append(frame)
def receive(self, id=None, timeout=1.0):
return None
@pytest.mark.unit
def test_hex_flasher_sends_basic_sequence(tmp_path, rp):
# Minimal valid Intel HEX file (EOF record)
hex_path = tmp_path / "fw.hex"
hex_path.write_text(":00000001FF\n")
lin = _StubLin()
flasher = HexFlasher(lin)
flasher.flash_hex(str(hex_path))
rp("hex_path", str(hex_path))
rp("sent_count", len(lin.sent))
# Placeholder assertion; refine as the flasher gains functionality
assert isinstance(lin.sent, list)