Update from upstream #11
@ -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
|
||||
|
@ -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, [])
|
||||
|
Loading…
Reference in New Issue
Block a user