Skip to content

Commit

Permalink
bump scmrepo to 0.0.23
Browse files Browse the repository at this point in the history
`scmrepo==0.0.23` includes proper support for windows file:// URLs
(iterative/scmrepo#68), so Windows tests
relying on file URLs had to be fixed in order to be valid
[RFC 8089](https://datatracker.ietf.org/doc/html/rfc8089) URLs.
  • Loading branch information
dtrifiro authored and skshetry committed Jun 1, 2022
1 parent 3d79177 commit 52f02d2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -66,7 +66,7 @@ install_requires =
typing-extensions>=3.7.4
fsspec[http]>=2021.10.1
aiohttp-retry>=2.4.5
scmrepo==0.0.22
scmrepo==0.0.23
dvc-render==0.0.5
dvclive>=0.7.3
dvc-data==0.0.2
Expand Down
14 changes: 8 additions & 6 deletions tests/func/test_api.py
Expand Up @@ -20,7 +20,7 @@ def test_get_url_external(tmp_dir, erepo_dir, cloud):
erepo_dir.dvc_gen("foo", "foo", commit="add foo")

# Using file url to force clone to tmp repo
repo_url = f"file://{erepo_dir}"
repo_url = f"file://{erepo_dir.as_posix()}"
expected_url = (cloud / "ac/bd18db4cc2f85cedef654fccc4a4d8").url
assert api.get_url("foo", repo=repo_url) == expected_url

Expand All @@ -32,7 +32,7 @@ def test_get_url_requires_dvc(tmp_dir, scm):
api.get_url("foo", repo=os.fspath(tmp_dir))

with pytest.raises(OutputNotFoundError, match="output 'foo'"):
api.get_url("foo", repo=f"file://{tmp_dir}")
api.get_url("foo", repo=f"file://{tmp_dir.as_posix()}")


def test_open_external(tmp_dir, erepo_dir, cloud):
Expand All @@ -51,7 +51,7 @@ def test_open_external(tmp_dir, erepo_dir, cloud):
remove(erepo_dir.dvc.odb.local.cache_dir)

# Using file url to force clone to tmp repo
repo_url = f"file://{erepo_dir}"
repo_url = f"file://{erepo_dir.as_posix()}"
with api.open("version", repo=repo_url) as fd:
assert fd.read() == "master"

Expand Down Expand Up @@ -138,7 +138,7 @@ def test_api_missing_local_cache_exists_on_remote(
remove(dvc.odb.local.cache_dir)
remove(first(files))

repo_url = f"file://{tmp_dir}" if as_external else None
repo_url = f"file://{tmp_dir.as_posix()}" if as_external else None
file_content = get_in(files, to_read.split(os.sep))
assert api.read(to_read, repo=repo_url) == file_content

Expand All @@ -154,7 +154,7 @@ def test_read_with_subrepos(tmp_dir, scm, local_cloud, local_repo):
subrepo.dvc_gen("dvc-file", "dvc-file", commit="add dir")
subrepo.dvc.push()

repo_path = None if local_repo else f"file://{tmp_dir}"
repo_path = None if local_repo else f"file://{tmp_dir.as_posix()}"
subrepo_path = os.path.join("dir", "subrepo")

assert api.read("foo.txt", repo=repo_path) == "foo.txt"
Expand Down Expand Up @@ -223,6 +223,8 @@ def test_open_from_remote(tmp_dir, erepo_dir, cloud, local_cloud):
remove(erepo_dir.dvc.odb.local.cache_dir)

with api.open(
os.path.join("dir", "foo"), repo=f"file://{erepo_dir}", remote="other"
os.path.join("dir", "foo"),
repo=f"file://{erepo_dir.as_posix()}",
remote="other",
) as fd:
assert fd.read() == "foo content"
4 changes: 2 additions & 2 deletions tests/func/test_external_repo.py
Expand Up @@ -57,7 +57,7 @@ def test_cache_reused(erepo_dir, mocker, local_cloud):
download_spy = mocker.spy(generic, "transfer")

# Use URL to prevent any fishy optimizations
url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
with external_repo(url) as repo:
repo.fetch()
assert download_spy.mock.call_count == 1
Expand All @@ -72,7 +72,7 @@ def test_cache_reused(erepo_dir, mocker, local_cloud):
def test_known_sha(erepo_dir):
erepo_dir.scm.commit("init")

url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
with external_repo(url) as repo:
rev = repo.scm.get_rev()
prev_rev = repo.scm.resolve_rev("HEAD^")
Expand Down
2 changes: 1 addition & 1 deletion tests/func/test_get.py
Expand Up @@ -266,7 +266,7 @@ def test_get_pipeline_tracked_outs(
dvc.scm.commit("add pipeline stage")

with git_dir.chdir():
Repo.get(f"file://{os.fspath(tmp_dir)}", "bar", out="baz")
Repo.get(f"file://{tmp_dir.as_posix()}", "bar", out="baz")
assert (git_dir / "baz").read_text() == "foo"


Expand Down
2 changes: 1 addition & 1 deletion tests/func/test_import.py
Expand Up @@ -408,7 +408,7 @@ def test_import_pipeline_tracked_outs(
dvc.scm.commit("add pipeline stage")

with erepo_dir.chdir():
erepo_dir.dvc.imp(f"file://{os.fspath(tmp_dir)}", "bar", out="baz")
erepo_dir.dvc.imp(f"file://{tmp_dir.as_posix()}", "bar", out="baz")
assert (erepo_dir / "baz").read_text() == "foo"


Expand Down
12 changes: 6 additions & 6 deletions tests/func/test_ls.py
Expand Up @@ -319,7 +319,7 @@ def test_ls_remote_repo(erepo_dir):
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")
erepo_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")

url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
files = Repo.ls(url)
match_files(
files,
Expand All @@ -340,7 +340,7 @@ def test_ls_remote_repo_recursive(erepo_dir):
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")
erepo_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")

url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
files = Repo.ls(url, recursive=True)
match_files(
files,
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_ls_remote_git_only_repo_recursive(git_dir):
with git_dir.chdir():
git_dir.scm_gen(FS_STRUCTURE, commit="init")

url = f"file://{git_dir}"
url = f"file://{git_dir.as_posix()}"
files = Repo.ls(url, recursive=True)
match_files(
files,
Expand All @@ -387,7 +387,7 @@ def test_ls_remote_repo_with_path_dir(erepo_dir):
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")
erepo_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")

url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
path = "model"
files = Repo.ls(url, path)
match_files(
Expand All @@ -408,7 +408,7 @@ def test_ls_remote_repo_with_rev(erepo_dir):
erepo_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")

rev = erepo_dir.scm.list_all_commits()[1]
url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
files = Repo.ls(url, rev=rev)
match_files(
files,
Expand All @@ -427,7 +427,7 @@ def test_ls_remote_repo_with_rev_recursive(erepo_dir):
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")

rev = erepo_dir.scm.list_all_commits()[1]
url = f"file://{erepo_dir}"
url = f"file://{erepo_dir.as_posix()}"
files = Repo.ls(url, rev=rev, recursive=True)
match_files(
files,
Expand Down
2 changes: 1 addition & 1 deletion tests/func/utils/test_strict_yaml.py
Expand Up @@ -394,7 +394,7 @@ def test_on_revision(
tmp_dir.scm_gen("dvc.yaml", text, commit="add dvc.yaml")
capsys.readouterr() # clear outputs

assert main(["ls", f"file://{tmp_dir}", "--rev", "HEAD"]) != 0
assert main(["ls", f"file://{tmp_dir.as_posix()}", "--rev", "HEAD"]) != 0

out, err = capsys.readouterr()
assert not out
Expand Down

0 comments on commit 52f02d2

Please sign in to comment.