Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_poplib.TestTimeouts Class Reference
Inheritance diagram for test.test_poplib.TestTimeouts:
Inheritance graph
[legend]
Collaboration diagram for test.test_poplib.TestTimeouts:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def server
def testTimeoutDefault
def testTimeoutNone
def testTimeoutValue

Public Attributes

 evt
 sock
 port

Detailed Description

Definition at line 307 of file test_poplib.py.


Member Function Documentation

def test.test_poplib.TestTimeouts.server (   self,
  evt,
  serv 
)

Definition at line 320 of file test_poplib.py.

00320 
00321     def server(self, evt, serv):
00322         serv.listen(5)
00323         try:
00324             conn, addr = serv.accept()
00325         except socket.timeout:
00326             pass
00327         else:
00328             conn.send(b"+ Hola mundo\n")
00329             conn.close()
00330         finally:
00331             serv.close()
00332             evt.set()

Definition at line 309 of file test_poplib.py.

00309 
00310     def setUp(self):
00311         self.evt = threading.Event()
00312         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00313         self.sock.settimeout(3)
00314         self.port = test_support.bind_port(self.sock)
00315         threading.Thread(target=self.server, args=(self.evt,self.sock)).start()
00316         time.sleep(.1)

Here is the caller graph for this function:

Definition at line 317 of file test_poplib.py.

00317 
00318     def tearDown(self):
00319         self.evt.wait()

Here is the caller graph for this function:

Definition at line 333 of file test_poplib.py.

00333 
00334     def testTimeoutDefault(self):
00335         self.assertTrue(socket.getdefaulttimeout() is None)
00336         socket.setdefaulttimeout(30)
00337         try:
00338             pop = poplib.POP3("localhost", self.port)
00339         finally:
00340             socket.setdefaulttimeout(None)
00341         self.assertEqual(pop.sock.gettimeout(), 30)
00342         pop.sock.close()

Here is the call graph for this function:

Definition at line 343 of file test_poplib.py.

00343 
00344     def testTimeoutNone(self):
00345         self.assertTrue(socket.getdefaulttimeout() is None)
00346         socket.setdefaulttimeout(30)
00347         try:
00348             pop = poplib.POP3(HOST, self.port, timeout=None)
00349         finally:
00350             socket.setdefaulttimeout(None)
00351         self.assertTrue(pop.sock.gettimeout() is None)
00352         pop.sock.close()

Here is the call graph for this function:

Definition at line 353 of file test_poplib.py.

00353 
00354     def testTimeoutValue(self):
00355         pop = poplib.POP3("localhost", self.port, timeout=30)
00356         self.assertEqual(pop.sock.gettimeout(), 30)
00357         pop.sock.close()
00358 

Here is the call graph for this function:


Member Data Documentation

Definition at line 310 of file test_poplib.py.

Definition at line 313 of file test_poplib.py.

Definition at line 311 of file test_poplib.py.


The documentation for this class was generated from the following file: