コード例 #1
0
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     with patch.object(socket.socket, 'bind') as mock_socket:
         identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
         server = ModbusUdpServer(context=None, identity=identity)
         server.threads.append(Mock(**{'running': True}))
         server.server_close()
         self.assertEqual(server.control.Identity.VendorName, 'VendorName')
         self.assertFalse(server.threads[0].running)
コード例 #2
0
ファイル: test_server_sync.py プロジェクト: Biondoap/pymodbus
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     with patch.object(socket.socket, 'bind') as mock_socket:
         identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
         server = ModbusUdpServer(context=None, identity=identity)
         server.threads.append(Mock(**{'running': True}))
         server.server_close()
         self.assertEqual(server.control.Identity.VendorName, 'VendorName')
         self.assertFalse(server.threads[0].running)
コード例 #3
0
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
     server = ModbusUdpServer(context=None,
                              identity=identity,
                              bind_and_activate=False)
     server.server_activate()
     server.threads.append(Mock(**{'running': True}))
     server.server_close()
     self.assertEqual(server.control.Identity.VendorName, 'VendorName')
     self.assertFalse(server.threads[0].running)