Description
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:
pytest-socket/pytest_socket.py
Lines 73 to 80 in cb5e7c5
...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!