From 6e0e5b426bf7fa198fa5522560a481568afb98d3 Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Tue, 30 Apr 2019 18:47:36 +0700 Subject: [PATCH] test: never run updater nor analytics in tests Previously that was only the case when running tests via `python -mtests` wrapper. --- tests/__main__.py | 6 +----- tests/conftest.py | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/__main__.py b/tests/__main__.py index a14479097..710810d06 100644 --- a/tests/__main__.py +++ b/tests/__main__.py @@ -10,12 +10,8 @@ os.putenv( "PATH", "{}:{}".format(os.path.join(REPO_ROOT, "bin"), os.getenv("PATH")) ) os.putenv("DVC_HOME", REPO_ROOT) -os.putenv("DVC_TEST", "true") -if len(sys.argv) == 1: - params = "" -else: - params = " ".join(sys.argv[1:]) +params = " ".join(sys.argv[1:]) cmd = ( "py.test -v -n=4 --timeout=600 --timeout_method=thread --cov=dvc " diff --git a/tests/conftest.py b/tests/conftest.py index c73c2f099..8ab491d80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,11 +5,16 @@ import os from git import Repo from git.exc import GitCommandNotFound +from dvc.utils.compat import cast_bytes_py2 from dvc.remote.ssh.connection import SSHConnection from dvc.repo import Repo as DvcRepo from .basic_env import TestDirFixture +# Prevent updater and analytics from running their processes +os.environ[cast_bytes_py2("DVC_TEST")] = cast_bytes_py2("true") + + @pytest.fixture(autouse=True) def debug(caplog): with caplog.at_level("DEBUG", logger="dvc"):