blob: 3af2491ecc58d41aaf0354354ab064efd868be60 [file] [log] [blame]
Skip Montanaro89feabc2003-03-30 04:54:24 +00001#!/usr/bin/env python
2
3import unittest
4from test import test_support
5
6import socket
7import urllib2
8import sys
9
10class URLTimeoutTest(unittest.TestCase):
11
12 TIMEOUT = 10.0
13
14 def setUp(self):
15 socket.setdefaulttimeout(self.TIMEOUT)
16
17 def tearDown(self):
18 socket.setdefaulttimeout(None)
19
20 def testURLread(self):
21 f = urllib2.urlopen("http://www.python.org/")
22 x = f.read()
23
24def test_main():
25 test_support.requires('network')
26
27 suite = unittest.TestSuite()
28 suite.addTest(unittest.makeSuite(URLTimeoutTest))
29 test_support.run_suite(suite)
30
31if __name__ == "__main__":
32 test_main()