diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-01 22:13:48 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-11-01 22:13:48 (GMT) |
commit | fd0680b19dfccf7bdb8b3f5e90c2e0bc2fd2aa00 (patch) | |
tree | 96cc2fd756dfd005e6fcca7356d01e8df5db2e51 /Lib | |
parent | 7e05e7d3b64b3874b8086e607601edd0f46666bd (diff) | |
download | cpython-fd0680b19dfccf7bdb8b3f5e90c2e0bc2fd2aa00.zip cpython-fd0680b19dfccf7bdb8b3f5e90c2e0bc2fd2aa00.tar.gz cpython-fd0680b19dfccf7bdb8b3f5e90c2e0bc2fd2aa00.tar.bz2 |
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.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/support.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index a7cac4a..0c69aac 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -458,10 +458,17 @@ def open_urlresource(url, *args, **kw): return open(fn, *args, **kw) print('\tfetching %s ...' % url, file=get_original_stdout()) - fn, _ = urllib.request.urlretrieve(url, fn) + f = urllib.request.urlopen(url, timeout=15) + try: + with open(fn, "wb") as out: + s = f.read() + while s: + out.write(s) + s = f.read() + finally: + f.close() return open(fn, *args, **kw) - class WarningsRecorder(object): """Convenience wrapper for the warnings list returned on entry to the warnings.catch_warnings() context manager. |