5858PORT_STOPBITS = 1
5959PORT_BYTESIZE = 8
6060PORT_PARITY = None
61- PORT_BAUDRATE = 9600 # 19200 # 115200 # use slow serial to get some contention
61+ PORT_BAUDRATE = 300 # 9600 # 19200 # 115200 # use slow serial to get some contention
6262PORT_TIMEOUT = 1.5
6363
6464has_pyserial = False
@@ -154,8 +154,8 @@ async def server_start( port, unit ):
154154 logging .warning ( "Starting Modbus Serial server for unit {unit} on {port} w/ {context}" .format (
155155 unit = unit , port = port , context = context ))
156156
157- # from pymodbus.server import ModbusSerialServer as modbus_server_rtu
158- from .pymodbus_fixes import modbus_server_rtu
157+ from pymodbus .server import ModbusSerialServer as modbus_server_rtu
158+ # from .remote .pymodbus_fixes import modbus_server_rtu
159159 server = modbus_server_rtu (
160160 port = port ,
161161 context = context ,
@@ -185,7 +185,7 @@ async def server_start( port, unit ):
185185 servers [unit ].start ()
186186
187187 time .sleep (.5 )
188- '''
188+
189189 # Try the bare Serial client(s), and then the locking version. Should be identical.
190190 for cls in ModbusSerialClient , modbus_client_rtu :
191191 logging .info ( "Testing Modbus/RTU Serial client: {cls.__name__}" .format ( cls = cls ))
@@ -200,12 +200,14 @@ async def server_start( port, unit ):
200200 rr2 = client .read_coils ( 2 , count = 1 , slave = 2 )
201201 assert (( not rr2 .isError () and rr2 .bits [0 ] == True ) or
202202 ( not rr1 .isError () and rr1 .bits [0 ] == False ))
203- rr3 = client.read_coils( 2, count=1, slave=3 )
204- assert rr3.isError()
203+ rr3 = None
204+ with suppress (pymodbus .exceptions .ModbusIOException ):
205+ rr3 = client .read_coils ( 2 , count = 1 , slave = 3 )
206+ assert rr3 is None
205207
206208 client .close ()
207209 del client
208- '''
210+
209211 # Now ensure we can pound away from multiple threads using the locking client.
210212 client = modbus_client_rtu (
211213 port = PORT_MASTER ,
0 commit comments