Update from upstream #11

Closed
soksanichenko wants to merge 158 commits from a8_updated into a8
2 changed files with 7 additions and 0 deletions
Showing only changes of commit 7fe32ae758 - Show all commits

View File

@ -1046,6 +1046,8 @@ def as_local_file(url):
yield local_filename
finally:
os.remove(local_filename)
elif url.startswith("file://"):
yield url[7:]
else:
# Not a remote url, return unchanged.
yield url

View File

@ -1060,3 +1060,8 @@ class TestAsLocalFile(PungiTestCase):
self.assertEqual(fn, self.filename)
self.assertTrue(os.path.exists(self.filename))
self.assertFalse(os.path.exists(self.filename))
def test_file_url(self, urlretrieve):
with util.as_local_file("file:///tmp/foo") as fn:
self.assertEqual(fn, "/tmp/foo")
self.assertEqual(urlretrieve.call_args_list, [])