[validator] Fix bug with version comparison
This patch fixes the below bug by properly checking the old and new version specifiers: It seems that packaging fixed its SpecifierSet class' 'contains' method recently which brought out a bug in validator: When checking minimum versions we get a false negative [1] result due to comparing '<str>' in '<SpecifierSet>', like '2.1.0' version string (from old '>2.1.0' specifier) in '>2.1.0' (new) specifier, which should be equal, but clearly version 2.1.0 is not in range >2.1.0, hence the comparison gives back an error. [1] Changed supported versions for dependency pyparsing from >2.1.0 to >2.1.0 without at least incrementing minor number Change-Id: Iac1691714eaa8f5c236ed4c79b8ea7be92b8fcd9
This commit is contained in:
parent
591f887f18
commit
707a514d69
@ -71,7 +71,7 @@ def compare_lower_bounds(start_reqs, hash_reqs, report):
|
||||
# There was a minimum but it has been removed.
|
||||
continue
|
||||
|
||||
if old_min.version not in req.specifier:
|
||||
if old_min != new_min and old_min.version not in req.specifier:
|
||||
# The old minimum is not in the new spec.
|
||||
report(('Changed supported versions for dependency {} from {} '
|
||||
'to {} without at least incrementing minor number').format(
|
||||
|
@ -187,11 +187,7 @@ class TestCompareLowerBounds(base.BaseTestCase):
|
||||
old, new, warnings.append,
|
||||
)
|
||||
print(warnings)
|
||||
# NOTE(elod.illes) this should not drop an error as the two specifier equals
|
||||
# but it drops: "Changed supported versions for dependency pbr from >2.1.0
|
||||
# to >2.1.0 without at least incrementing minor number"
|
||||
# self.assertEqual(0, len(warnings))
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def test_lower_comparator_with_lower_new_minimum_version(self):
|
||||
warnings = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user