-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathtest_config_gitfs_fix.py
More file actions
38 lines (31 loc) · 1.09 KB
/
test_config_gitfs_fix.py
File metadata and controls
38 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from dvc.config import Config
from dvc.fs import GitFileSystem
def test_config_loads_from_workspace_with_gitfs(tmp_dir, scm):
"""Config should load from workspace, not git history when using GitFileSystem."""
dvc_dir = tmp_dir / ".dvc"
dvc_dir.mkdir()
# Create complete config in workspace
(dvc_dir / "config").write_text(
"""\
[core]
remote = test-webdav
[remote "test-webdav"]
url = webdav://localhost:9000/
"""
)
(dvc_dir / "config.local").write_text(
"""\
[remote "test-webdav"]
password = 12345678
"""
)
# Need at least one commit for HEAD to exist
tmp_dir.scm_gen("foo", "foo", commit="init")
# Create Config with GitFileSystem
git_fs = GitFileSystem(scm=scm, rev="HEAD")
config = Config(
dvc_dir="/.dvc", local_dvc_dir=str(dvc_dir), fs=git_fs, validate=True
)
# Should load from workspace
assert config["remote"]["test-webdav"]["url"] == "webdav://localhost:9000/"
assert config["remote"]["test-webdav"]["password"] == "12345678"