Merge "Ignore empty requirements/constraints when building lower-constraints"
This commit is contained in:
commit
427c73372e
@ -48,7 +48,8 @@ def merge_constraints_sets(constraints_sets):
|
||||
all_constraints = collections.defaultdict(list)
|
||||
for constraints_set in constraints_sets:
|
||||
for constraint_name, constraint in constraints_set.items():
|
||||
all_constraints[constraint_name].extend(constraint)
|
||||
if constraint_name:
|
||||
all_constraints[constraint_name].extend(constraint)
|
||||
for constraint_name, constraints in sorted(all_constraints.items()):
|
||||
val = max((c[0] for c in constraints), key=get_requirements_version)
|
||||
yield val.to_line()
|
||||
|
@ -55,3 +55,15 @@ class BuildLowerConstraintsTest(testtools.TestCase):
|
||||
expected,
|
||||
list(build_lower_constraints.merge_constraints_sets(inputs))
|
||||
)
|
||||
|
||||
def test_one_input_file_with_comments(self):
|
||||
inputs = [
|
||||
requirement.parse('package==1.2.3\n # package2==0.9.8'),
|
||||
]
|
||||
expected = [
|
||||
'package==1.2.3\n',
|
||||
]
|
||||
self.assertEqual(
|
||||
expected,
|
||||
list(build_lower_constraints.merge_constraints_sets(inputs))
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user