summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/support.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index f24adc8..e11fbae 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -453,13 +453,12 @@ def open_urlresource(url, *args, **kw):
requires('urlfetch')
filename = urllib.parse.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, *args, **kw)
+ fn = os.path.join(os.path.dirname(__file__), "data", filename)
+ if os.path.exists(fn):
+ return open(fn)
print('\tfetching %s ...' % url, file=get_original_stdout())
- fn, _ = urllib.request.urlretrieve(url, filename)
+ fn, _ = urllib.request.urlretrieve(url, fn)
return open(fn, *args, **kw)