mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
analytics: don't verify config from repo
Otherwise this will raise an exception from analytics worker: ``` dvc config cache.type sometypo ``` But running that same command with `--system` or `--global` flag outside of repo won't raise that. Also need to better handle ConfigObjError, but that is a separate issue.
This commit is contained in:
+3
-3
@@ -219,10 +219,10 @@ class Analytics(object):
|
||||
|
||||
try:
|
||||
dvc_dir = Repo.find_dvc_dir()
|
||||
config = Config(dvc_dir)
|
||||
except NotDvcRepoError:
|
||||
config = Config(validate=False)
|
||||
return config
|
||||
dvc_dir = None
|
||||
|
||||
return Config(dvc_dir, validate=False)
|
||||
|
||||
@staticmethod
|
||||
def is_enabled(cmd=None):
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
from dvc.analytics import Analytics
|
||||
from dvc.config import Config
|
||||
from dvc.repo import NotDvcRepoError
|
||||
|
||||
|
||||
def test_broken_config(mocker, dvc_repo):
|
||||
Config(dvc_repo.dvc_dir, validate=False).set("cache", "type", "unknown")
|
||||
|
||||
assert Analytics._get_current_config()
|
||||
|
||||
with mocker.patch(
|
||||
"dvc.repo.Repo.find_dvc_dir", side_effect=NotDvcRepoError(".")
|
||||
):
|
||||
assert Analytics._get_current_config()
|
||||
Reference in New Issue
Block a user