mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* dvc: refactor config
Advantages:
- read like a dict
- modify as a dict for testing or manipulation purposes
- wrap modifications into context manager to save them:
with config.edit("local") as conf:
conf["core"]["remote"] = "new-default"
Design decisions:
- dropped string constants
- remote sections are parsed into a simple subdict upon load
- remote config schema is now defined by url scheme
- relative paths are handled transparently upon load/save
- user config and remote manipulations are moved to commands
- same dev manipulations are done by simply modifying a config dict
* test: do not set cache.type for remotes that doesn't support it
* dvc: fix windows absolute paths validation in config
* test: fix windows separate drive test
* dvc: stylistic fixes in config
17 lines
514 B
Python
17 lines
514 B
Python
from dvc.config import COMPILED_SCHEMA
|
|
|
|
|
|
def test_remote_config_no_traverse():
|
|
d = COMPILED_SCHEMA({"remote": {"myremote": {"url": "url"}}})
|
|
assert "no_traverse" not in d["remote"]["myremote"]
|
|
|
|
d = COMPILED_SCHEMA(
|
|
{"remote": {"myremote": {"url": "url", "no_traverse": "fAlSe"}}}
|
|
)
|
|
assert not d["remote"]["myremote"]["no_traverse"]
|
|
|
|
d = COMPILED_SCHEMA(
|
|
{"remote": {"myremote": {"url": "url", "no_traverse": "tRuE"}}}
|
|
)
|
|
assert d["remote"]["myremote"]["no_traverse"]
|