mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00

and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. From SF patch #662807.
29 lines
553 B
Python
29 lines
553 B
Python
#!/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()
|