From 4bc86367bb4c07382b729aab44206fe59543c12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n?= Date: Wed, 25 Oct 2023 18:28:32 +0200 Subject: [PATCH] Add handling for spcial non-void check cases --- conans/model/version_range.py | 4 ++++ .../model/version/test_version_range_intersection.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conans/model/version_range.py b/conans/model/version_range.py index 150ce35fd9f..4360758a109 100644 --- a/conans/model/version_range.py +++ b/conans/model/version_range.py @@ -48,6 +48,10 @@ def __lt__(self, other): else: if other.operator == ">": return True + # There's a possibility of getting here while validating if a range is non-void + # by comparing >= & <= for lower limit <= upper limit + elif other.operator == "<=": + return True else: return self.display_version.pre is not None return False diff --git a/conans/test/unittests/model/version/test_version_range_intersection.py b/conans/test/unittests/model/version/test_version_range_intersection.py index 00c91a2d881..8f82e5b91e1 100644 --- a/conans/test/unittests/model/version/test_version_range_intersection.py +++ b/conans/test/unittests/model/version/test_version_range_intersection.py @@ -17,7 +17,9 @@ ['<=1.0', "<=1.1", "<=1.0"], # One lower limit, one upper ['>=1.0', "<2.0", ">=1.0 <2.0"], - ['>=1', '<=1', "[>=1 <=1]"], + ['>=1', '<=1', ">=1 <=1"], + [">=1", "<=1-", ">=1 <=1-"], + [">=1-", "<=1", ">=1- <=1"], # Two lower, one upper ['>=1.0', ">1.0 <2.0", ">1.0 <2.0"], ['>=1.0', ">1.1 <2.0", ">1.1 <2.0"],