mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
analytics: add DVC_ANALYTICS env var (#6448)
This commit is contained in:
@@ -87,6 +87,40 @@ def test_is_enabled(dvc, config, result, monkeypatch, tmp_global_dir):
|
||||
|
||||
# reset DVC_TEST env var, which affects `is_enabled()`
|
||||
monkeypatch.delenv("DVC_TEST")
|
||||
monkeypatch.delenv("DVC_ANALYTICS", raising=False)
|
||||
|
||||
assert result == analytics.is_enabled()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config, env, result",
|
||||
[
|
||||
(None, None, True),
|
||||
(None, "true", True),
|
||||
(None, "false", False),
|
||||
("false", None, False),
|
||||
("false", "true", True),
|
||||
("false", "false", False),
|
||||
("true", None, True),
|
||||
("true", "true", True),
|
||||
("true", "false", False),
|
||||
],
|
||||
)
|
||||
def test_is_enabled_env(dvc, config, env, result, monkeypatch, tmp_global_dir):
|
||||
# reset DVC_TEST env var, which affects `is_enabled()`
|
||||
monkeypatch.delenv("DVC_TEST")
|
||||
monkeypatch.delenv("DVC_ANALYTICS", raising=False)
|
||||
with dvc.config.edit() as conf:
|
||||
conf["core"] = {}
|
||||
|
||||
assert analytics.is_enabled()
|
||||
|
||||
if config is not None:
|
||||
with dvc.config.edit() as conf:
|
||||
conf["core"] = {"analytics": config}
|
||||
|
||||
if env is not None:
|
||||
monkeypatch.setenv("DVC_ANALYTICS", env)
|
||||
|
||||
assert result == analytics.is_enabled()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user