From 2180d312c36e62c7175c112b38cbde79c3c90377 Mon Sep 17 00:00:00 2001 From: "Ivan A. Melnikov" Date: Mon, 12 Aug 2019 11:42:06 +0400 Subject: 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 --- test/test_conn.py | 8 ++++---- 1 file 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() -- cgit v1.2.1