kumquat-buildroot/support/testing/tests/package/sample_python_minimalmodbus.py
Marcus Hoffmann 8f7e112ab2 support/testing: add minimalmodbus runtime test
Signed-off-by: Marcus Hoffmann <bubu@bubu1.eu>
[yann.morin.1998@free.fr: add the comment to explain failure is success]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-02-05 16:06:19 +01:00

12 lines
415 B
Python

import minimalmodbus
from serial.serialutil import SerialException
# We can't test proper behaviour in emulation, because there is
# actually no emulated modbus hardware, so we rely on the module
# to fail in an expected way to consider it is working correctly.
# Failure (of the script) is success (of the test)!
try:
instrument = minimalmodbus.Instrument('/dev/ttyUSB99', 1)
except SerialException:
pass