Skip to content

Commit

Permalink
test-client-sync: Fix UDP connection test.
Browse files Browse the repository at this point in the history
Rather than passing in a vanilla object, we should pass in something
that implements the settimeout method.
  • Loading branch information
sjlongland committed Jun 4, 2015
1 parent 3263801 commit e27dbb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/test_client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def testUdpClientAddressFamily(self):
def testUdpClientConnect(self):
''' Test the Udp client connection method'''
with patch.object(socket, 'socket') as mock_method:
mock_method.return_value = object()
class DummySocket(object):
def settimeout(self, *a, **kwa):
pass
mock_method.return_value = DummySocket()
client = ModbusUdpClient()
self.assertTrue(client.connect())

Expand Down

0 comments on commit e27dbb4

Please sign in to comment.