config: read merged config by default (#5179)

* config: read merged config by default

* tests: move root test out of config tests

* tests: refactor config tests

* cli: fix cache dir command
This commit is contained in:
Ruslan Kuprieiev
2020-12-31 00:37:39 +02:00
committed by GitHub
parent c28e671f47
commit 8162bb159c
7 changed files with 233 additions and 103 deletions
+25
View File
@@ -1,5 +1,6 @@
import os
import stat
import textwrap
import configobj
import pytest
@@ -213,3 +214,27 @@ def test_shared_cache(tmp_dir, dvc, group, dir_mode):
for fname in fnames:
path = os.path.join(root, fname)
assert stat.S_IMODE(os.stat(path).st_mode) == 0o444
def test_cache_dir_local(tmp_dir, dvc, caplog):
(tmp_dir / ".dvc" / "config.local").write_text(
textwrap.dedent(
"""\
[cache]
dir = some/path
"""
)
)
path = os.path.join(dvc.dvc_dir, "some", "path")
caplog.clear()
assert main(["cache", "dir", "--local"]) == 0
assert path in caplog.text
caplog.clear()
assert main(["cache", "dir"]) == 0
assert path in caplog.text
caplog.clear()
assert main(["cache", "dir", "--repo"]) == 251
assert "option 'dir' doesn't exist in section 'cache'" in caplog.text