@@ -103,31 +103,31 @@ def callback_new_connection(self) -> ModbusProtocol:
103103 return new_stub
104104
105105
106- test_port = 5004
106+ TEST_PORT = 5004
107107
108108class ClientTester : # pylint: disable=too-few-public-methods
109109 """Main program."""
110110
111111 def __init__ (self , comm : CommType ):
112112 """Initialize runtime tester."""
113- global test_port # pylint: disable=global-statement
113+ global TEST_PORT # pylint: disable=global-statement
114114 self .comm = comm
115115 host = NULLMODEM_HOST
116116 self .client : modbusClient .AsyncModbusTcpClient | modbusClient .AsyncModbusSerialClient
117117 if comm == CommType .TCP :
118118 self .client = modbusClient .AsyncModbusTcpClient (
119119 host ,
120- port = test_port ,
120+ port = TEST_PORT ,
121121 )
122122 else : # if comm == CommType.SERIAL:
123- host = f"{ NULLMODEM_HOST } :{ test_port } "
123+ host = f"{ NULLMODEM_HOST } :{ TEST_PORT } "
124124 self .client = modbusClient .AsyncModbusSerialClient (
125125 host ,
126126 )
127127 server_params = self .client .ctx .comm_params .copy ()
128- server_params .source_address = (host , test_port )
128+ server_params .source_address = (host , TEST_PORT )
129129 self .stub = TransportStub (server_params , True , simulate_server )
130- test_port += 1
130+ TEST_PORT += 1
131131
132132
133133 async def run (self ):
@@ -148,7 +148,7 @@ class ServerTester: # pylint: disable=too-few-public-methods
148148
149149 def __init__ (self , comm : CommType ):
150150 """Initialize runtime tester."""
151- global test_port # pylint: disable=global-statement
151+ global TEST_PORT # pylint: disable=global-statement
152152 self .comm = comm
153153 self .store = ModbusDeviceContext (
154154 di = ModbusSequentialDataBlock (0 , [17 ] * 100 ),
@@ -166,19 +166,19 @@ def __init__(self, comm: CommType):
166166 self .context ,
167167 framer = FramerType .SOCKET ,
168168 identity = self .identity ,
169- address = (NULLMODEM_HOST , test_port ),
169+ address = (NULLMODEM_HOST , TEST_PORT ),
170170 )
171171 else : # if comm == CommType.SERIAL:
172172 self .server = modbusServer .ModbusSerialServer (
173173 self .context ,
174174 framer = FramerType .SOCKET ,
175175 identity = self .identity ,
176- port = f"{ NULLMODEM_HOST } :{ test_port } " ,
176+ port = f"{ NULLMODEM_HOST } :{ TEST_PORT } " ,
177177 )
178178 client_params = self .server .comm_params .copy ()
179179 client_params .timeout_connect = 1.0
180180 self .stub = TransportStub (client_params , False , simulate_client )
181- test_port += 1
181+ TEST_PORT += 1
182182
183183
184184 async def run (self ):
0 commit comments