Feature request: Also block DNS lookups (socket.getaddrinfo)
Thank you for this plugin, which helps keep our tests fast and safe! One piece of information that can still leak out even when using it, though, is DNS lookups. It would be great if we could also block calls to socket.getaddrinfo in the same way.
I believe this can be done in a basic way by adding socket.getaddrinfo = guarded to the disable_socket() method here: https://github.com/miketheman/pytest-socket/blob/cb5e7c51f3bff343d3899af26b112894138de988/pytest_socket.py#L73-L80
...and perhaps updating the exception message to not specifically reference socket.socket.
I have not sent a PR for this because I don't know the pytest API well enough to understand how and when disable_socket is getting called, or how this should interact with socket_allow_hosts() further down — but if that's not a concern, I'd be happy to submit that change for consideration.
Thanks again!
This issue is stale because it has been open for 90 days with no activity.
This issue was closed because it has been inactive for 30 days since being marked as stale.
I think this is still a valid feature request? There's even been a PR for it (#64).
This issue is stale because it has been open for 90 days with no activity.
This issue is stale because it has been open for 90 days with no activity.
This issue was closed because it has been inactive for 30 days since being marked as stale.
I found this issue when trying to get a good working session in during a flight.
This is for sure still an issue, IMHO, since the whole idea is to make tests run without any external dependencies - and that includes DNS servers (i.e. any reliance on the internet).