diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-03-13 18:35:26 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2019-03-13 19:01:27 -0700 |
commit | 02bc28017b9ad665d58baab424d279bc1b3dd1c1 (patch) | |
tree | a7f3a9b2a992e10f9b239efdb4642fd17a805277 | |
parent | 7965460a7253a5f5c23e7343c0c06c40e40f471e (diff) | |
download | kafka-python-mock_dns_test_conn.tar.gz |
Mock dns lookups in test_connmock_dns_test_conn
-rw-r--r-- | test/test_conn.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/test_conn.py b/test/test_conn.py index 953c112..66b8a0c 100644 --- a/test/test_conn.py +++ b/test/test_conn.py @@ -17,6 +17,13 @@ import kafka.errors as Errors @pytest.fixture +def dns_lookup(mocker): + return mocker.patch('kafka.conn.dns_lookup', + return_value=[(socket.AF_INET, + None, None, None, + ('localhost', 9092))]) + +@pytest.fixture def _socket(mocker): socket = mocker.MagicMock() socket.connect_ex.return_value = 0 @@ -25,7 +32,7 @@ def _socket(mocker): @pytest.fixture -def conn(_socket): +def conn(_socket, dns_lookup): conn = BrokerConnection('localhost', 9092, socket.AF_INET) return conn |