Skip to content

Commit

Permalink
tests: add test for dvc.api.open with remote
Browse files Browse the repository at this point in the history
Covers #7341
  • Loading branch information
skshetry committed Apr 21, 2022
1 parent f22da81 commit 26ac696
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/func/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,17 @@ def test_get_url_subrepos(tmp_dir, scm, local_cloud):
local_cloud / "37" / "b51d194a7513e45b56f6524f2d51f2"
)
assert api.get_url("subrepo/bar") == expected_url


@pytest.mark.xfail(reason="https://github.com/iterative/dvc/issues/7341")
def test_open_from_remote(tmp_dir, erepo_dir, cloud, local_cloud):
erepo_dir.add_remote(config=cloud.config, name="other")
erepo_dir.add_remote(config=local_cloud.config, default=True)
erepo_dir.dvc_gen({"dir": {"foo": "foo content"}}, commit="create file")
erepo_dir.dvc.push(remote="other")
remove(erepo_dir.dvc.odb.local.cache_dir)

with api.open(
os.path.join("dir", "foo"), repo=erepo_dir.as_uri(), remote="other"
) as fd:
assert fd.read() == "foo content"

0 comments on commit 26ac696

Please sign in to comment.