[Python-checkins] r76040 - in python/branches/py3k: Lib/test/support.py
antoine.pitrou
python-checkins at python.org
Sun Nov 1 23:13:49 CET 2009
Author: antoine.pitrou
Date: Sun Nov 1 23:13:48 2009
New Revision: 76040
Log:
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.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/test/support.py
Modified: python/branches/py3k/Lib/test/support.py
==============================================================================
--- python/branches/py3k/Lib/test/support.py (original)
+++ python/branches/py3k/Lib/test/support.py Sun Nov 1 23:13:48 2009
@@ -458,10 +458,17 @@
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.
More information about the Python-checkins
mailing list