summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 5b4cc5b..5672a20 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -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