feat: adapt actuation receiver to state's qi_session

Makes actuation tests pass. In main, the timing of the socket no longer contains the time to receive and send data, but only the processing time of the message handler.

ref: N25B-168
This commit is contained in:
Twirre Meulenbelt
2025-10-16 21:46:46 +02:00
parent 56c804b7eb
commit 4c3aa3a911
5 changed files with 91 additions and 17 deletions

View File

@@ -0,0 +1,40 @@
import unittest
import mock
from robot_interface.utils.timeblock import TimeBlock
class AnyFloat(object):
def __eq__(self, other):
return isinstance(other, float)
class TestTimeBlock(unittest.TestCase):
def test_no_limit(self):
callback = mock.Mock()
with TimeBlock(callback):
pass
callback.assert_called_once_with(AnyFloat())
def test_exceed_limit(self):
callback = mock.Mock()
with TimeBlock(callback, 0):
pass
callback.assert_called_once_with(AnyFloat())
def test_within_limit(self):
callback = mock.Mock()
with TimeBlock(callback, 5):
pass
callback.assert_not_called()
if __name__ == '__main__':
unittest.main()