From 0ffc8816d65cc24817d5c0a0450bd7ba5a0b8373 Mon Sep 17 00:00:00 2001 From: Martin Teichmann <martin.teichmann@xfel.eu> Date: Sun, 18 Feb 2024 17:10:38 +0100 Subject: [PATCH] fix tests --- ebpfcat/ethercat_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ebpfcat/ethercat_test.py b/ebpfcat/ethercat_test.py index 3447c4a..c691e57 100644 --- a/ebpfcat/ethercat_test.py +++ b/ebpfcat/ethercat_test.py @@ -25,7 +25,7 @@ from unittest import TestCase, main, skip from .devices import AnalogInput, AnalogOutput, Motor from .terminals import EL4104, EL3164, EK1814, Skip -from .ethercat import ECCmd, Terminal +from .ethercat import ECCmd, MachineState, Terminal from .ebpfcat import ( FastSyncGroup, SyncGroup, TerminalVar, Device, EBPFTerminal, PacketDesc, SterilePacket) @@ -82,11 +82,14 @@ class MockTerminal(Terminal): await self.apply_eeprom() - async def to_operational(self, state=8): + async def to_operational(self, state=MachineState.OPERATIONAL): + assert isinstance(state, MachineState) + before = self.operational self.operational = state + return state, 0, before async def sdo_read(self, index, subindex=None): - assert self.operational >= 2 + assert self.operational.value >= 2 if subindex is None: r = b'' for i in count(1): -- GitLab