(self)
| 1942 | self.serv = None |
| 1943 | |
| 1944 | def testTimeoutAttribute(self): |
| 1945 | # This will prove that the timeout gets through HTTPConnection |
| 1946 | # and into the socket. |
| 1947 | |
| 1948 | # default -- use global socket timeout |
| 1949 | self.assertIsNone(socket.getdefaulttimeout()) |
| 1950 | socket.setdefaulttimeout(30) |
| 1951 | try: |
| 1952 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT) |
| 1953 | httpConn.connect() |
| 1954 | finally: |
| 1955 | socket.setdefaulttimeout(None) |
| 1956 | self.assertEqual(httpConn.sock.gettimeout(), 30) |
| 1957 | httpConn.close() |
| 1958 | |
| 1959 | # no timeout -- do not use global socket default |
| 1960 | self.assertIsNone(socket.getdefaulttimeout()) |
| 1961 | socket.setdefaulttimeout(30) |
| 1962 | try: |
| 1963 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, |
| 1964 | timeout=None) |
| 1965 | httpConn.connect() |
| 1966 | finally: |
| 1967 | socket.setdefaulttimeout(None) |
| 1968 | self.assertEqual(httpConn.sock.gettimeout(), None) |
| 1969 | httpConn.close() |
| 1970 | |
| 1971 | # a value |
| 1972 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) |
| 1973 | httpConn.connect() |
| 1974 | self.assertEqual(httpConn.sock.gettimeout(), 30) |
| 1975 | httpConn.close() |
| 1976 | |
| 1977 | |
| 1978 | class PersistenceTest(TestCase): |
nothing calls this directly
no test coverage detected