I\'m trying to test a package that provides interfaces to a few web services. It has a test suite that is supposed to test most functions without connecting to the
Monkey patching socket ought to do it:
socket
import socket def guard(*args, **kwargs): raise Exception("I told you not to use the Internet!") socket.socket = guard
Make sure this runs before any other import.