mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
Use our own redbot.core.VersionInfo over distutils.StrictVersion (#2188)
* Implements our required subset of PEP 440 in redbot.core.VersionInfo * Added unit tests for version string parsing and comparisons Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
@@ -1,6 +1,36 @@
|
||||
from redbot import core
|
||||
from redbot.core import VersionInfo
|
||||
|
||||
|
||||
def test_version_working():
|
||||
assert hasattr(core, "__version__")
|
||||
assert core.__version__[0] == "3"
|
||||
|
||||
|
||||
# When adding more of these, ensure they are added in ascending order of precedence
|
||||
version_tests = (
|
||||
"3.0.0a32.post10.dev12",
|
||||
"3.0.0rc1.dev1",
|
||||
"3.0.0rc1",
|
||||
"3.0.0",
|
||||
"3.0.1",
|
||||
"3.0.1.post1.dev1",
|
||||
"3.0.1.post1",
|
||||
"2018.10.6b21",
|
||||
)
|
||||
|
||||
|
||||
def test_version_info_str_parsing():
|
||||
for version_str in version_tests:
|
||||
assert version_str == str(VersionInfo.from_str(version_str))
|
||||
|
||||
|
||||
def test_version_info_lt():
|
||||
for next_idx, cur in enumerate(version_tests[:-1], start=1):
|
||||
cur_test = VersionInfo.from_str(cur)
|
||||
next_test = VersionInfo.from_str(version_tests[next_idx])
|
||||
assert cur_test < next_test
|
||||
|
||||
|
||||
def test_version_info_gt():
|
||||
assert VersionInfo.from_str(version_tests[1]) > VersionInfo.from_str(version_tests[0])
|
||||
|
||||
Reference in New Issue
Block a user