-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7383 from drew2a/fix/7369
Check on ancient version
- Loading branch information
Showing
5 changed files
with
112 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from tribler.core.upgrade.version_manager import TriblerVersion | ||
|
||
|
||
def test_create_from_version(tmp_path): | ||
# Test that we can create a TriblerVersion object from a version string | ||
v = TriblerVersion(tmp_path, '7.13.1') | ||
assert v.version.version == [7, 13, 1] | ||
|
||
|
||
def test_equal(tmp_path): | ||
# Test correctness of equal comparison | ||
def v(s): | ||
return TriblerVersion(tmp_path, s).version | ||
|
||
assert v('7.13.1') == v('7.13.1') | ||
assert v('7.13.1') != v('7.13.2') | ||
|
||
|
||
def test_greater(tmp_path): | ||
# Test correctness of greater than comparison | ||
def v(s): | ||
return TriblerVersion(tmp_path, s).version | ||
|
||
assert v('7.13.1') >= v('7.13.1') | ||
assert v('7.13.1') > v('7.13') | ||
assert v('7.13.1') > v('7.12') | ||
|
||
|
||
def test_less(tmp_path): | ||
# Test correctness of less than comparison | ||
def v(s): | ||
return TriblerVersion(tmp_path, s).version | ||
|
||
assert v('7.13.1') <= v('7.13.1') | ||
assert v('7.13') < v('7.13.1') | ||
assert v('7.12') < v('7.13.1') | ||
|
||
|
||
def test_is_ancient(tmp_path): | ||
# Test that we can correctly determine whether a version is ancient | ||
last_supported = '7.5' | ||
assert not TriblerVersion(tmp_path, '7.13').is_ancient(last_supported) | ||
assert not TriblerVersion(tmp_path, '7.5').is_ancient(last_supported) | ||
|
||
assert TriblerVersion(tmp_path, '7.4').is_ancient(last_supported) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters