Files
dvc/tests/func/test_updater.py
T
Ruslan Kuprieiev 0d330c1b9b dvc: move Updater out of Repo()
Fixes #2039

Required by #2012 to be able to fetch data through the API without
interuption from updater.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
2019-06-14 00:54:36 +03:00

52 lines
1020 B
Python

import os
import mock
import pytest
from dvc.updater import Updater
@pytest.fixture
def updater(dvc_repo):
return Updater(dvc_repo.dvc_dir)
def test_updater(updater):
# NOTE: only test on travis CRON to avoid generating too much logs
travis = os.getenv("TRAVIS") == "true"
if not travis:
return
cron = os.getenv("TRAVIS_EVENT_TYPE") == "cron"
if not cron:
return
env = os.environ.copy()
if env.get("CI"):
del env["CI"]
with mock.patch.dict(os.environ, env):
updater.check()
updater.check()
updater.check()
def test_check_version_newer(updater):
updater.latest = "0.20.8"
updater.current = "0.21.0"
assert not updater._is_outdated()
def test_check_version_equal(updater):
updater.latest = "0.20.8"
updater.current = "0.20.8"
assert not updater._is_outdated()
def test_check_version_outdated(updater):
updater.latest = "0.21.0"
updater.current = "0.20.8"
assert updater._is_outdated()