mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
(fix) DVC_SITE_CACHE_DIR environment variable should override core.site_cache_dir (#10778)
* Prioritize DVC_SITE_CACHE_DIR over core.site_cache_dir * Add tests for proper prioritization of env var and config * Tests require python-3.9 compatible typing, use Optional * Remove comment * Fixup
This commit is contained in:
@@ -21,3 +21,13 @@ def test_site_cache_dir_on_unix(monkeypatch):
|
||||
def test_site_cache_dir_env_var(monkeypatch):
|
||||
monkeypatch.setenv(DVC_SITE_CACHE_DIR, "foo_bar")
|
||||
assert site_cache_dir() == "foo_bar"
|
||||
|
||||
|
||||
def test_site_cache_dir_with_config_parameter(monkeypatch):
|
||||
monkeypatch.delenv(DVC_SITE_CACHE_DIR)
|
||||
assert site_cache_dir(config_site_cache_dir="foo_bar") == "foo_bar"
|
||||
|
||||
|
||||
def test_site_cache_dir_env_var_precedence(monkeypatch):
|
||||
monkeypatch.setenv(DVC_SITE_CACHE_DIR, "foo")
|
||||
assert site_cache_dir(config_site_cache_dir="bar") == "foo"
|
||||
|
||||
Reference in New Issue
Block a user