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