Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tested bazel versions #269

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/aspect/execute_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
TestedVersions(bazel="5.4.1", python="3.8.18"),
TestedVersions(bazel="6.5.0", python="3.9.18"),
TestedVersions(bazel="7.0.0", python="3.10"),
TestedVersions(bazel="7.1.1", python="3.11", is_default=True),
TestedVersions(bazel="8.0.0-pre.20240516.1", python="3.12"),
TestedVersions(bazel="7.2.1", python="3.11", is_default=True),
TestedVersions(bazel="rolling", python="3.12"),
]

VERSION_SPECIFIC_ARGS = {
Expand Down
10 changes: 10 additions & 0 deletions test/aspect/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class CompatibleVersions:
before: str = ""

def is_compatible_to(self, version: str) -> bool:
if version == "rolling":
# Ignore 'minimum' as it cannot be incompatible to 'rolling'
# 'rolling' cannot be compatible to any 'before'
return self.before == ""

if self.minimum == "rolling":
return False
if self.before == "rolling":
return True

comply_with_min_version = version >= self.minimum if self.minimum else True
comply_with_max_version = version < self.before if self.before else True
return comply_with_min_version and comply_with_max_version
8 changes: 8 additions & 0 deletions test/aspect/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ def test_above_max_version(self) -> None:
def test_inside_interval(self) -> None:
self.assertTrue(CompatibleVersions(minimum="0.9.0", before="1.1.0").is_compatible_to("1.0.0"))

def test_only_rolling_is_compatible_to_min_version_rolling(self) -> None:
self.assertFalse(CompatibleVersions(minimum="rolling").is_compatible_to("999.999.999"))
self.assertTrue(CompatibleVersions(minimum="rolling").is_compatible_to("rolling"))

def test_max_version_rolling_is_compatible_to_all_except_rolling(self) -> None:
self.assertTrue(CompatibleVersions(before="rolling").is_compatible_to("999.999.999"))
self.assertFalse(CompatibleVersions(before="rolling").is_compatible_to("rolling"))


if __name__ == "__main__":
unittest.main()