jasonrbriggs / stomp.py

“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
495 stars 167 forks source link

mock dns responses to make running tests easier and more efficient #383

Closed mikebonnet closed 2 years ago

mikebonnet commented 2 years ago

By monkeypatching socket.getaddrinfo() in a couple of places, the requirement to add entries to the hosts file (which usually requires root access) is removed. It also avoid long timeouts in dual-stack IPv4/IPv6 environments where the tests try to connect to the IPv6 address for localhost first, but the test service is only listening on the IPv4 address.

Also update test_alternate_hosts() to wait for a successful connection, and fix a logic error in StubStompServer where get_next_frame() was returning an empty string but the caller was testing for None.

jasonrbriggs commented 2 years ago

Thanks!