diff options
Diffstat (limited to 'Lib/test/support.py')
-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. |