add, import-url: always resolve the output in the local path for --to-remote (#5473)

* add, import-url: always resolve the output in the local path for --to-remote

* windows

* use the proper fixture
This commit is contained in:
Batuhan Taskaya
2021-02-19 15:22:59 +02:00
committed by GitHub
parent 14944dd9e0
commit 8102ede5cc
5 changed files with 60 additions and 7 deletions
+15
View File
@@ -340,6 +340,21 @@ def test_import_url_to_remote_directory(tmp_dir, dvc, workspace, local_remote):
)
def test_import_url_to_remote_absolute(
tmp_dir, make_tmp_dir, dvc, local_remote
):
tmp_abs_dir = make_tmp_dir("abs")
tmp_foo = tmp_abs_dir / "foo"
tmp_foo.write_text("foo")
stage = dvc.imp_url(str(tmp_foo), to_remote=True)
foo = tmp_dir / "foo"
assert stage.deps[0].fspath == str(tmp_foo)
assert stage.outs[0].fspath == os.fspath(foo)
assert foo.with_suffix(".dvc").exists()
def test_import_url_to_remote_invalid_combinations(dvc):
with pytest.raises(InvalidArgumentError, match="--no-exec"):
dvc.imp_url("s3://bucket/foo", no_exec=True, to_remote=True)