mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-03 15:28:29 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82e559a51a | ||
|
|
33c6a9b19b | ||
|
|
14cc748139 | ||
|
|
40abf34c8c |
+1
-1
@@ -3,7 +3,7 @@ coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: 85
|
||||
target: 90
|
||||
threshold: 10%
|
||||
patch:
|
||||
default:
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
from .env import DVC_ANALYTICS
|
||||
from .env import DVC_NO_ANALYTICS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -44,8 +44,8 @@ def is_enabled():
|
||||
if env2bool("DVC_TEST"):
|
||||
return False
|
||||
|
||||
enabled = env2bool(DVC_ANALYTICS, None)
|
||||
if enabled is None:
|
||||
enabled = not os.getenv(DVC_NO_ANALYTICS)
|
||||
if enabled:
|
||||
enabled = to_bool(
|
||||
Config(validate=False).get("core", {}).get("analytics", "true")
|
||||
)
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ DVCLIVE_RESUME = "DVCLIVE_RESUME"
|
||||
DVC_IGNORE_ISATTY = "DVC_IGNORE_ISATTY"
|
||||
DVC_EXP_GIT_REMOTE = "DVC_EXP_GIT_REMOTE"
|
||||
DVC_EXP_AUTO_PUSH = "DVC_EXP_AUTO_PUSH"
|
||||
DVC_ANALYTICS = "DVC_ANALYTICS"
|
||||
DVC_NO_ANALYTICS = "DVC_NO_ANALYTICS"
|
||||
|
||||
@@ -455,7 +455,7 @@ class Experiments:
|
||||
)
|
||||
logger.info(
|
||||
"\nTo promote an experiment to a Git branch run:\n\n"
|
||||
"\tdvc exp branch <exp>\n"
|
||||
"\tdvc exp branch <exp> <branch>\n"
|
||||
)
|
||||
|
||||
@scm_locked
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
_BASE_VERSION = "2.6.2"
|
||||
_BASE_VERSION = "2.6.3"
|
||||
|
||||
|
||||
def _generate_version(base_version):
|
||||
|
||||
@@ -87,7 +87,7 @@ 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)
|
||||
monkeypatch.delenv("DVC_NO_ANALYTICS", raising=False)
|
||||
|
||||
assert result == analytics.is_enabled()
|
||||
|
||||
@@ -96,20 +96,23 @@ def test_is_enabled(dvc, config, result, monkeypatch, tmp_global_dir):
|
||||
"config, env, result",
|
||||
[
|
||||
(None, None, True),
|
||||
(None, "true", True),
|
||||
(None, "false", False),
|
||||
(None, "true", False),
|
||||
(None, "false", False), # only checking if env is set
|
||||
("false", None, False),
|
||||
("false", "true", True),
|
||||
("false", "true", False),
|
||||
("false", "false", False),
|
||||
("true", None, True),
|
||||
("true", "true", True),
|
||||
("true", "false", False),
|
||||
("true", "true", False),
|
||||
("true", "false", False), # we checking if env is set
|
||||
],
|
||||
)
|
||||
def test_is_enabled_env(dvc, config, env, result, monkeypatch, tmp_global_dir):
|
||||
def test_is_enabled_env_neg(
|
||||
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)
|
||||
monkeypatch.delenv("DVC_NO_ANALYTICS", raising=False)
|
||||
|
||||
with dvc.config.edit() as conf:
|
||||
conf["core"] = {}
|
||||
|
||||
@@ -120,7 +123,7 @@ def test_is_enabled_env(dvc, config, env, result, monkeypatch, tmp_global_dir):
|
||||
conf["core"] = {"analytics": config}
|
||||
|
||||
if env is not None:
|
||||
monkeypatch.setenv("DVC_ANALYTICS", env)
|
||||
monkeypatch.setenv("DVC_NO_ANALYTICS", env)
|
||||
|
||||
assert result == analytics.is_enabled()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user