mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
(fix) site_cache_dir() must return DVC_SITE_CACHE_DIR if it exists (#10776)
* DVC_SITE_CACHE_DIR must be sent first, deal with platformdirs afterwards * Test should check default behaviour when no env var is set * Add test: site_cache_dir() must return the env var if set
This commit is contained in:
@@ -3,7 +3,7 @@ import sys
|
||||
import pytest
|
||||
|
||||
from dvc.dirs import global_config_dir, site_cache_dir
|
||||
from dvc.env import DVC_GLOBAL_CONFIG_DIR
|
||||
from dvc.env import DVC_GLOBAL_CONFIG_DIR, DVC_SITE_CACHE_DIR
|
||||
|
||||
|
||||
def test_global_config_dir_respects_env_var(monkeypatch):
|
||||
@@ -13,5 +13,11 @@ def test_global_config_dir_respects_env_var(monkeypatch):
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "linux", reason="Only for Unix platforms")
|
||||
def test_site_cache_dir_on_unix():
|
||||
def test_site_cache_dir_on_unix(monkeypatch):
|
||||
monkeypatch.delenv(DVC_SITE_CACHE_DIR, raising=False)
|
||||
assert site_cache_dir() == "/var/tmp/dvc"
|
||||
|
||||
|
||||
def test_site_cache_dir_env_var(monkeypatch):
|
||||
monkeypatch.setenv(DVC_SITE_CACHE_DIR, "foo_bar")
|
||||
assert site_cache_dir() == "foo_bar"
|
||||
|
||||
Reference in New Issue
Block a user