summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllibnet.py
blob: 03728e1e0ce05f29fc055c5b31819a48969c346f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python

import unittest
from test import test_support

import socket
import urllib2
import sys

class URLTimeoutTest(unittest.TestCase):

    TIMEOUT = 10.0

    def setUp(self):
        socket.setdefaulttimeout(self.TIMEOUT)

    def tearDown(self):
        socket.setdefaulttimeout(None)

    def testURLread(self):
        f = urllib2.urlopen("http://www.python.org/")
        x = f.read()

def test_main():
    test_support.requires('network')
    test_support.run_unittest(URLTimeoutTest)

if __name__ == "__main__":
    test_main()