Skip to content

Commit 8041d70

Browse files
authored
Merge pull request #3044 from pared/2896_api
tests: api: convert to dir helpers
2 parents 0ad3548 + af42531 commit 8041d70

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/func/test_api.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from dvc import api
99
from dvc.api import SummonError
10+
from dvc.compat import fspath
1011
from dvc.exceptions import FileMissingError
1112
from dvc.main import main
1213
from dvc.path_info import URLInfo
@@ -106,16 +107,13 @@ def _set_remote_url_and_commit(repo, remote_url):
106107
repo.scm.commit("modify remote")
107108

108109

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

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

117116

118-
# TODO: simplify, we shouldn't need run.
119117
def test_open_not_cached(dvc):
120118
metric_file = "metric.txt"
121119
metric_content = "0.6"

0 commit comments

Comments
 (0)