summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan A. Melnikov <iv@altlinux.org>2019-08-12 11:42:06 +0400
committerJeff Widman <jeff@jeffwidman.com>2019-08-15 11:36:05 -0700
commit2180d312c36e62c7175c112b38cbde79c3c90377 (patch)
tree090befe4f4cc5917d16feb45c8e5f038cec4fc6e /test
parentea35fdfe1d66eb481e3406ad161a1255573dd50f (diff)
downloadkafka-python-2180d312c36e62c7175c112b38cbde79c3c90377.tar.gz
tests: Use socket.SOCK_STREAM in assertions
socket.SOCK_STREAM is platform specific and on some platforms (most notably on Linux on MIPS) does not equal 1; so it's better to use the constant where appropriate. This change fixes the tests on my MIPS32 LE machine. Signed-off-by: Ivan A. Melnikov <iv@altlinux.org>
Diffstat (limited to 'test')
-rw-r--r--test/test_conn.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/test_conn.py b/test/test_conn.py
index 5da5eff..7a6588b 100644
--- a/test/test_conn.py
+++ b/test/test_conn.py
@@ -275,7 +275,7 @@ def test_lookup_on_connect():
]
with mock.patch("socket.getaddrinfo", return_value=mock_return1) as m:
conn.connect()
- m.assert_called_once_with(hostname, port, 0, 1)
+ m.assert_called_once_with(hostname, port, 0, socket.SOCK_STREAM)
assert conn._sock_afi == afi1
assert conn._sock_addr == sockaddr1
conn.close()
@@ -289,7 +289,7 @@ def test_lookup_on_connect():
with mock.patch("socket.getaddrinfo", return_value=mock_return2) as m:
conn.last_attempt = 0
conn.connect()
- m.assert_called_once_with(hostname, port, 0, 1)
+ m.assert_called_once_with(hostname, port, 0, socket.SOCK_STREAM)
assert conn._sock_afi == afi2
assert conn._sock_addr == sockaddr2
conn.close()
@@ -304,7 +304,7 @@ def test_relookup_on_failure():
with mock.patch("socket.getaddrinfo", return_value=mock_return1) as m:
last_attempt = conn.last_attempt
conn.connect()
- m.assert_called_once_with(hostname, port, 0, 1)
+ m.assert_called_once_with(hostname, port, 0, socket.SOCK_STREAM)
assert conn.disconnected()
assert conn.last_attempt > last_attempt
@@ -317,7 +317,7 @@ def test_relookup_on_failure():
with mock.patch("socket.getaddrinfo", return_value=mock_return2) as m:
conn.last_attempt = 0
conn.connect()
- m.assert_called_once_with(hostname, port, 0, 1)
+ m.assert_called_once_with(hostname, port, 0, socket.SOCK_STREAM)
assert conn._sock_afi == afi2
assert conn._sock_addr == sockaddr2
conn.close()