Back to index

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

List of all members.

Public Member Functions

def setUp
def tearDown
def testTimeoutAttribute

Public Attributes

 serv

Static Public Attributes

 PORT = None

Detailed Description

Definition at line 406 of file test_httplib.py.


Member Function Documentation

Definition at line 409 of file test_httplib.py.

00409 
00410     def setUp(self):
00411         self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
00412         TimeoutTest.PORT = support.bind_port(self.serv)
00413         self.serv.listen(5)

Here is the caller graph for this function:

Definition at line 414 of file test_httplib.py.

00414 
00415     def tearDown(self):
00416         self.serv.close()
00417         self.serv = None

Here is the caller graph for this function:

Definition at line 418 of file test_httplib.py.

00418 
00419     def testTimeoutAttribute(self):
00420         # This will prove that the timeout gets through HTTPConnection
00421         # and into the socket.
00422 
00423         # default -- use global socket timeout
00424         self.assertTrue(socket.getdefaulttimeout() is None)
00425         socket.setdefaulttimeout(30)
00426         try:
00427             httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT)
00428             httpConn.connect()
00429         finally:
00430             socket.setdefaulttimeout(None)
00431         self.assertEqual(httpConn.sock.gettimeout(), 30)
00432         httpConn.close()
00433 
00434         # no timeout -- do not use global socket default
00435         self.assertTrue(socket.getdefaulttimeout() is None)
00436         socket.setdefaulttimeout(30)
00437         try:
00438             httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT,
00439                                               timeout=None)
00440             httpConn.connect()
00441         finally:
00442             socket.setdefaulttimeout(None)
00443         self.assertEqual(httpConn.sock.gettimeout(), None)
00444         httpConn.close()
00445 
00446         # a value
00447         httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30)
00448         httpConn.connect()
00449         self.assertEqual(httpConn.sock.gettimeout(), 30)
00450         httpConn.close()
00451 

Here is the call graph for this function:


Member Data Documentation

Definition at line 407 of file test_httplib.py.

Definition at line 410 of file test_httplib.py.


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