mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
imp_url: normalize path for default out name (#2248)
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
95110a865c
commit
217f2c4dbd
+2
-5
@@ -1,6 +1,4 @@
|
||||
import os
|
||||
|
||||
from dvc.utils.compat import urlparse
|
||||
from dvc.utils.compat import pathlib
|
||||
from dvc.repo.scm_context import scm_context
|
||||
|
||||
|
||||
@@ -10,8 +8,7 @@ def imp_url(
|
||||
):
|
||||
from dvc.stage import Stage
|
||||
|
||||
default_out = os.path.basename(urlparse(url).path)
|
||||
out = out or default_out
|
||||
out = out or pathlib.PurePath(url).name
|
||||
|
||||
with self.state:
|
||||
stage = Stage.create(
|
||||
|
||||
@@ -46,15 +46,10 @@ class TestDefaultOutput(TestDvc):
|
||||
|
||||
|
||||
class TestFailedImportMessage(TestDvc):
|
||||
@patch("dvc.repo.imp_url.urlparse")
|
||||
def test(self, imp_urlparse_patch):
|
||||
@patch("dvc.repo.imp_url.imp_url", side_effect=DvcException("message"))
|
||||
def test(self, _):
|
||||
page_address = "http://somesite.com/file_name"
|
||||
|
||||
def dvc_exception(*args, **kwargs):
|
||||
raise DvcException("message")
|
||||
|
||||
imp_urlparse_patch.side_effect = dvc_exception
|
||||
|
||||
self._caplog.clear()
|
||||
|
||||
with self._caplog.at_level(logging.ERROR, logger="dvc"):
|
||||
|
||||
Reference in New Issue
Block a user