(self)
| 1896 | self.serv = None |
| 1897 | |
| 1898 | def testTimeoutAttribute(self): |
| 1899 | # This will prove that the timeout gets through HTTPConnection |
| 1900 | # and into the socket. |
| 1901 | |
| 1902 | # default -- use global socket timeout |
| 1903 | self.assertIsNone(socket.getdefaulttimeout()) |
| 1904 | socket.setdefaulttimeout(30) |
| 1905 | try: |
| 1906 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT) |
| 1907 | httpConn.connect() |
| 1908 | finally: |
| 1909 | socket.setdefaulttimeout(None) |
| 1910 | self.assertEqual(httpConn.sock.gettimeout(), 30) |
| 1911 | httpConn.close() |
| 1912 | |
| 1913 | # no timeout -- do not use global socket default |
| 1914 | self.assertIsNone(socket.getdefaulttimeout()) |
| 1915 | socket.setdefaulttimeout(30) |
| 1916 | try: |
| 1917 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, |
| 1918 | timeout=None) |
| 1919 | httpConn.connect() |
| 1920 | finally: |
| 1921 | socket.setdefaulttimeout(None) |
| 1922 | self.assertEqual(httpConn.sock.gettimeout(), None) |
| 1923 | httpConn.close() |
| 1924 | |
| 1925 | # a value |
| 1926 | httpConn = client.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) |
| 1927 | httpConn.connect() |
| 1928 | self.assertEqual(httpConn.sock.gettimeout(), 30) |
| 1929 | httpConn.close() |
| 1930 | |
| 1931 | |
| 1932 | class PersistenceTest(TestCase): |
nothing calls this directly
no test coverage detected