'Set up test fixtures.'

def setUp(self):

    self.mock_tracker = scaffold.MockTracker()
    def mock_getsockopt(level, optname, buflen=None):
        result = object()
        if (optname is socket.SO_TYPE):
            result = socket.SOCK_RAW
        return result
    self.mock_socket_getsockopt_func = mock_getsockopt
    self.mock_socket_error = socket.error(errno.ENOTSOCK, 'Socket    operation    on    non-socket')
    self.mock_socket = scaffold.Mock('socket.socket', tracker=self.mock_tracker)
    self.mock_socket.getsockopt.mock_raises = self.mock_socket_error
    def mock_socket_fromfd(fd, family, type, proto=None):
        return self.mock_socket
    scaffold.mock('socket.fromfd', returns_func=mock_socket_fromfd, tracker=self.mock_tracker)
