summaryrefslogtreecommitdiff
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2008-06-18 20:49:58 +0000
committerJeremy Hylton <jeremy@alum.mit.edu>2008-06-18 20:49:58 +0000
commit1afc1696167547a5fa101c53e5a3ab4717f8852c (patch)
treee989e72e71530d892214562785df7e11f84c1111 /Lib/test/support.py
parenta656d2cd8984f1ecb5a7e2cd09a18f72452f2b78 (diff)
downloadcpython-git-1afc1696167547a5fa101c53e5a3ab4717f8852c.tar.gz
Make a new urllib package .
It consists of code from urllib, urllib2, urlparse, and robotparser. The old modules have all been removed. The new package has five submodules: urllib.parse, urllib.request, urllib.response, urllib.error, and urllib.robotparser. The urllib.request.urlopen() function uses the url opener from urllib2. Note that the unittests have not been renamed for the beta, but they will be renamed in the future. Joint work with Senthil Kumaran.
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index c011c10b47..c6ce7601de 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -352,10 +352,10 @@ def check_syntax_error(testcase, statement):
testcase.fail('Missing SyntaxError: "%s"' % statement)
def open_urlresource(url, *args, **kw):
- import urllib, urlparse
+ import urllib.request, urllib.parse
requires('urlfetch')
- filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
+ filename = urllib.parse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
for path in [os.path.curdir, os.path.pardir]:
fn = os.path.join(path, filename)
@@ -363,7 +363,7 @@ def open_urlresource(url, *args, **kw):
return open(fn, *args, **kw)
print('\tfetching %s ...' % url, file=get_original_stdout())
- fn, _ = urllib.urlretrieve(url, filename)
+ fn, _ = urllib.request.urlretrieve(url, filename)
return open(fn, *args, **kw)