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

Fix is_geti version check #434

Merged
merged 5 commits into from
Jun 10, 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
26 changes: 3 additions & 23 deletions geti_sdk/platform_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,10 @@ def __gt__(self, other):
raise TypeError(
f"Unsupported comparison operation, {other} is not a GetiVersion."
)
if self.is_geti and other.is_geti:
if self.version != other.version:
return self.version > other.version
else:
return self.time_tag > other.time_tag
if self.version != other.version:
return self.version > other.version
else:
if self.is_geti and not other.is_geti:
return True
elif not self.is_geti and other.is_geti:
return False
else:
return self.time_tag > other.time_tag
return self.time_tag > other.time_tag

def __lt__(self, other):
"""
Expand Down Expand Up @@ -159,18 +151,6 @@ def is_sc_1_1(self) -> bool:
and self._SC11_TIMETAG <= self.time_tag <= self._GETI10_TIMETAG
)

@property
def is_geti(self) -> bool:
"""
Return True if the version corresponds to any version of the Geti platform.
Return False if it corresponds to any SC version.
"""
return (
self.version > Version("1.0.0b0")
and self.time_tag >= self._GETI10_TIMETAG
and not (self.is_sc_1_1 or self.is_sc_mvp)
)


SC_MVP_VERSION = GetiVersion("1.0.0-release-20220129184214")
SC_11_VERSION = GetiVersion("1.1.0-release-20220624125113")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ def test_product_version(self, fxt_geti_session: GetiSession):
version_tests = [
fxt_geti_session.version.is_sc_mvp,
fxt_geti_session.version.is_sc_1_1,
fxt_geti_session.version.is_geti,
]
assert sum(version_tests) == 1
assert sum(version_tests) == 0

@pytest.mark.vcr()
def test_logout(self, fxt_geti_session: GetiSession):
Expand Down
19 changes: 1 addition & 18 deletions tests/pre-merge/unit/test_platform_version_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
# See the License for the specific language governing permissions
# and limitations under the License.

from geti_sdk.platform_versions import (
GETI_10_VERSION,
GETI_11_VERSION,
SC_11_VERSION,
SC_MVP_VERSION,
)
from geti_sdk.platform_versions import GETI_10_VERSION, GETI_11_VERSION


class TestGetiVersion:
Expand All @@ -26,17 +21,5 @@ def test_version_parsing_and_comparison(self):
Test parsing the version from a version string, for different release versions
of the Intel Geti platform. Also test comparisons between versions
"""

assert SC_MVP_VERSION.is_sc_mvp and not SC_MVP_VERSION.is_geti
assert (
SC_11_VERSION.is_sc_1_1
and not SC_11_VERSION.is_geti
and not SC_11_VERSION.is_sc_mvp
)
assert GETI_10_VERSION.is_geti

assert GETI_10_VERSION > SC_11_VERSION
assert SC_11_VERSION > SC_MVP_VERSION
assert not SC_MVP_VERSION > GETI_10_VERSION
assert GETI_10_VERSION < GETI_11_VERSION
assert GETI_11_VERSION >= GETI_10_VERSION
Loading