Commit 7111e479 authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 76040 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r76040 | antoine.pitrou | 2009-11-01 23:13:48 +0100 (dim., 01 nov. 2009) | 9 lines

  Merged revisions 76037 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r76037 | antoine.pitrou | 2009-11-01 23:02:03 +0100 (dim., 01 nov. 2009) | 3 lines

    Use a custom timeout in test_support.open_urlresource.
  ........
................
parent 6f162473
......@@ -455,9 +455,16 @@ def open_urlresource(url, *args, **kw):
return open(fn, *args, **kw)
print('\tfetching %s ...' % url, file=get_original_stdout())
fn, _ = urllib.request.urlretrieve(url, filename)
return open(fn, *args, **kw)
f = urllib.request.urlopen(url, timeout=15)
try:
with open(filename, "wb") as out:
s = f.read()
while s:
out.write(s)
s = f.read()
finally:
f.close()
return open(filename, *args, **kw)
class WarningsRecorder(object):
"""Convenience wrapper for the warnings list returned on
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment