Commit 7a926e05 authored by FichteFoll's avatar FichteFoll

Fix --test-repositories tests when download fails

parent 285bab38
...@@ -471,14 +471,12 @@ class TestContainer(object): ...@@ -471,14 +471,12 @@ class TestContainer(object):
if re.match('https?://', path, re.I) is not None: if re.match('https?://', path, re.I) is not None:
# Download the repository # Download the repository
try: try:
f = urlopen(path) with urlopen(path) as f:
source = f.read().decode("utf-8", 'replace') source = f.read().decode("utf-8", 'replace')
except Exception as e: except Exception as e:
cls._write(stream, 'failed (%s)\n' % str_cls(e)) cls._write(stream, 'failed (%s)\n' % str_cls(e))
yield cls._fail("Downloading %s failed" % path, e) yield cls._fail("Downloading %s failed" % path, e)
return return
finally:
f.close()
else: else:
try: try:
with _open(path) as f: with _open(path) as f:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment