From cd9c500c929ab05b0221d9f24f6b138df99a37a9 Mon Sep 17 00:00:00 2001 From: Federico Negri Date: Wed, 26 Mar 2025 08:45:32 +0100 Subject: [PATCH] Skip version check in dev mode --- src/ansys/hps/client/check_version.py | 11 +++++++++++ tests/test_check_versions.py | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/ansys/hps/client/check_version.py b/src/ansys/hps/client/check_version.py index 8e0e4a9ae..fbffd43f2 100644 --- a/src/ansys/hps/client/check_version.py +++ b/src/ansys/hps/client/check_version.py @@ -26,10 +26,13 @@ from enum import Enum from functools import wraps +import logging from typing import Protocol from .exceptions import VersionCompatibilityError +log = logging.getLogger(__name__) + class HpsRelease(Enum): """HPS release versions.""" @@ -67,6 +70,10 @@ def check_min_version(version: str, min_version: str) -> bool: """Check if a version string meets a minimum version.""" from packaging.version import parse + if version in ["0.0.dev", "0.0.0"]: + log.warning("Skipping min version check for backend development version") + return True + return parse(version) >= parse(min_version) @@ -74,6 +81,10 @@ def check_max_version(version: str, max_version: str) -> bool: """Check if a version string meets a maximum version.""" from packaging.version import parse + if version in ["0.0.dev", "0.0.0"]: + log.warning("Skipping max version check for backend development version") + return True + return parse(version) <= parse(max_version) diff --git a/tests/test_check_versions.py b/tests/test_check_versions.py index 2dee9520b..f9a6a9667 100644 --- a/tests/test_check_versions.py +++ b/tests/test_check_versions.py @@ -88,3 +88,8 @@ def fn3(self): assert MockApi("0.1.8").fn3() assert MockApi("1.2.3").fn3() + + # test skipping check for dev version + assert MockApi("0.0.dev").fn1() + assert MockApi("0.0.0").fn2() + assert MockApi("0.0.dev").fn3()