improve version assertions in tests

fixes broken tests due to flaky string comparisons
This commit is contained in:
figsoda 2023-04-26 23:24:38 -04:00
parent 430c441072
commit 2fdb989360
8 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ def test_main(helpers: conftest.Helpers) -> None:
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
).stdout.strip() ).stdout.strip()
assert version >= "8.5.2" assert tuple(map(int, version.split("."))) >= (8, 5, 2)
commit = subprocess.run( commit = subprocess.run(
["git", "-C", path, "log", "-1"], ["git", "-C", path, "log", "-1"],
text=True, text=True,

View File

@ -23,7 +23,7 @@ def test_main(helpers: conftest.Helpers) -> None:
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
).stdout.strip() ).stdout.strip()
assert version >= "30" assert int(version) >= 30
commit = subprocess.run( commit = subprocess.run(
["git", "-C", path, "log", "-1"], ["git", "-C", path, "log", "-1"],
text=True, text=True,

View File

@ -23,7 +23,7 @@ def test_main(helpers: conftest.Helpers) -> None:
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
).stdout.strip() ).stdout.strip()
assert version >= "8.5.2" assert tuple(map(int, version.split("."))) >= (8, 5, 2)
commit = subprocess.run( commit = subprocess.run(
["git", "-C", path, "log", "-1"], ["git", "-C", path, "log", "-1"],
text=True, text=True,

View File

@ -23,7 +23,7 @@ def test_main(helpers: conftest.Helpers) -> None:
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
).stdout.strip() ).stdout.strip()
assert version >= "0.22.0" assert tuple(map(int, version.split("."))) >= (0, 22, 0)
commit = subprocess.run( commit = subprocess.run(
["git", "-C", path, "log", "-1"], ["git", "-C", path, "log", "-1"],
text=True, text=True,

View File

@ -23,5 +23,5 @@ def test_update(helpers: conftest.Helpers) -> None:
], ],
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) ).stdout.strip()
assert version.stdout.strip() > "10.8.6" assert tuple(map(int, version.split("."))) > (10, 8, 6)

View File

@ -23,7 +23,7 @@ def test_main(helpers: conftest.Helpers) -> None:
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
).stdout.strip() ).stdout.strip()
assert version >= "3.0.1" assert tuple(map(int, version.split("."))) >= (3, 0, 1)
commit = subprocess.run( commit = subprocess.run(
["git", "-C", path, "log", "-1"], ["git", "-C", path, "log", "-1"],
text=True, text=True,

View File

@ -23,5 +23,5 @@ def test_update(helpers: conftest.Helpers) -> None:
], ],
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) ).stdout.strip()
assert version.stdout.strip() >= "0.6.8" assert tuple(map(int, version.split("."))) >= (0, 6, 8)

View File

@ -23,5 +23,5 @@ def test_update(helpers: conftest.Helpers) -> None:
], ],
text=True, text=True,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
) ).stdout.strip()
assert version.stdout.strip() >= "0.3.6" assert tuple(map(int, version.split("."))) >= (0, 3, 6)