mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
fix and test outdate check (#1368)
* fix and test outdate check * split test cases
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
eac86b5b4f
commit
79c5cc0e85
+7
-3
@@ -92,9 +92,13 @@ class Updater(object): # pragma: no cover
|
||||
l_major, l_minor, l_patch = [int(x) for x in self.latest.split('.')]
|
||||
c_major, c_minor, c_patch = [int(x) for x in self.current.split('.')]
|
||||
|
||||
return (l_major > c_major or
|
||||
l_minor > c_minor or
|
||||
l_patch > c_patch)
|
||||
if l_major != c_major:
|
||||
return l_major > c_major
|
||||
|
||||
if l_minor != c_minor:
|
||||
return l_minor > c_minor
|
||||
|
||||
return l_patch > c_patch
|
||||
|
||||
def _notify(self):
|
||||
message = (
|
||||
|
||||
@@ -23,3 +23,21 @@ class TestUpdater(TestDvc):
|
||||
self.dvc.updater.check()
|
||||
|
||||
os.environ = env.copy()
|
||||
|
||||
def test_check_version_newer(self):
|
||||
self.dvc.updater.latest = "0.20.8"
|
||||
self.dvc.updater.current = "0.21.0"
|
||||
|
||||
self.assertFalse(self.dvc.updater._is_outdated())
|
||||
|
||||
def test_check_version_equal(self):
|
||||
self.dvc.updater.latest = "0.20.8"
|
||||
self.dvc.updater.current = "0.20.8"
|
||||
|
||||
self.assertFalse(self.dvc.updater._is_outdated())
|
||||
|
||||
def test_check_version_outdated(self):
|
||||
self.dvc.updater.latest = "0.21.0"
|
||||
self.dvc.updater.current = "0.20.8"
|
||||
|
||||
self.assertTrue(self.dvc.updater._is_outdated())
|
||||
|
||||
Reference in New Issue
Block a user