Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.mock_socket Namespace Reference

Classes

class  MockFile
class  MockSocket
class  gaierror
class  error

Functions

def reply_with
def socket
def create_connection
def setdefaulttimeout
def getdefaulttimeout
def getfqdn
def gethostname
def gethostbyname

Variables

 _defaulttimeout = None
 _reply_data = None
 AF_INET = None
 SOCK_STREAM = None
 SOL_SOCKET = None
 SO_REUSEADDR = None

Detailed Description

Mock socket module used by the smtpd and smtplib tests.

Function Documentation

def test.mock_socket.create_connection (   address,
  timeout = socket_module._GLOBAL_DEFAULT_TIMEOUT 
)

Definition at line 109 of file mock_socket.py.

00109 
00110 def create_connection(address, timeout=socket_module._GLOBAL_DEFAULT_TIMEOUT):
00111     try:
00112         int_port = int(address[1])
00113     except ValueError:
00114         raise error
00115     ms = MockSocket()
00116     if timeout is socket_module._GLOBAL_DEFAULT_TIMEOUT:
00117         timeout = getdefaulttimeout()
00118     ms.settimeout(timeout)
00119     return ms
00120 

Here is the call graph for this function:

Definition at line 126 of file mock_socket.py.

00126 
00127 def getdefaulttimeout():
00128     return _defaulttimeout
00129 

Here is the caller graph for this function:

Definition at line 130 of file mock_socket.py.

00130 
00131 def getfqdn():
00132     return ""
00133 

Definition at line 138 of file mock_socket.py.

00138 
00139 def gethostbyname(name):
00140     return ""
00141 

Here is the caller graph for this function:

Definition at line 134 of file mock_socket.py.

00134 
00135 def gethostname():
00136     pass
00137 

Here is the caller graph for this function:

Definition at line 14 of file mock_socket.py.

00014 
00015 def reply_with(line):
00016     global _reply_data
00017     _reply_data = line
00018 

Definition at line 121 of file mock_socket.py.

00121 
00122 def setdefaulttimeout(timeout):
00123     global _defaulttimeout
00124     _defaulttimeout = timeout
00125 

def test.mock_socket.socket (   family = None,
  type = None,
  proto = None 
)

Definition at line 105 of file mock_socket.py.

00105 
00106 def socket(family=None, type=None, proto=None):
00107     return MockSocket()
00108 


Variable Documentation

Definition at line 8 of file mock_socket.py.

Definition at line 9 of file mock_socket.py.

Definition at line 151 of file mock_socket.py.

Definition at line 154 of file mock_socket.py.

Definition at line 152 of file mock_socket.py.

Definition at line 153 of file mock_socket.py.