Patch #1276356: Implement new resource "urlfetch" for regrtest.

This enables even impatient people to run tests that require remote
files such as test_normalization and test_codecmaps_*.
This commit is contained in:
Hye-Shik Chang 2005-12-10 17:44:27 +00:00
parent 432be36056
commit aaa2f1dea7
10 changed files with 29 additions and 74 deletions

View file

@ -237,7 +237,21 @@ def check_syntax(statement):
else:
print 'Missing SyntaxError: "%s"' % statement
def open_urlresource(url):
import urllib, urlparse
import os.path
filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL!
for path in [os.path.curdir, os.path.pardir]:
fn = os.path.join(path, filename)
if os.path.exists(fn):
return open(fn)
requires('urlfetch')
print >> get_original_stdout(), '\tfetching %s ...' % url
fn, _ = urllib.urlretrieve(url, filename)
return open(fn)
#=======================================================================
# Preliminary PyUNIT integration.