Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions tests/func/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from dvc import api
from dvc.api import SummonError
from dvc.compat import fspath
from dvc.exceptions import FileMissingError
from dvc.main import main
from dvc.path_info import URLInfo
Expand Down Expand Up @@ -100,16 +101,13 @@ def _set_remote_url_and_commit(repo, remote_url):
repo.scm.commit("modify remote")


# FIXME: this test doesn't use scm ;D
def test_open_scm_controlled(dvc_repo, repo_dir):
stage, = dvc_repo.add(repo_dir.FOO)
def test_open_scm_controlled(tmp_dir, erepo_dir):
erepo_dir.scm_gen({"scm_controlled": "file content"}, commit="create file")

stage_content = open(stage.path, "r").read()
with api.open(stage.path) as fd:
assert fd.read() == stage_content
with api.open("scm_controlled", repo=fspath(erepo_dir)) as fd:
assert fd.read() == "file content"


# TODO: simplify, we shouldn't need run.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is an easy way to have a non-cached file without run, an alternative could be add-ing and modifying stage file, but that is artificial, and probably will not require less work than run.

def test_open_not_cached(dvc):
metric_file = "metric.txt"
metric_content = "0.6"
Expand Down