Correct error message when lower-constraints.txt is being checked

When lower-constraints.txt was handed in as validate step,
the error message still referred to upper-constraints.txt
which seemed confusing.

Change-Id: I8ef87db2eca820c0099ca64f92390549ea3e8f34
This commit is contained in:
Dirk Mueller 2018-03-08 10:26:07 +01:00
parent bce5ccf418
commit cd3bb9d3ff
2 changed files with 12 additions and 12 deletions

View File

@ -15,6 +15,7 @@
""" """
import argparse import argparse
import os
from openstack_requirements import constraints from openstack_requirements import constraints
from openstack_requirements import requirement from openstack_requirements import requirement
@ -49,15 +50,15 @@ def main():
# Check the format of the constraints file. # Check the format of the constraints file.
print('\nChecking %s' % args.upper_constraints) print('\nChecking %s' % args.upper_constraints)
upper_constraints = read_requirements_file(args.upper_constraints) constraints_txt = read_requirements_file(args.upper_constraints)
for msg in constraints.check_format(upper_constraints): for msg in constraints.check_format(constraints_txt):
print(msg) print(msg)
error_count += 1 error_count += 1
# Check that the constraints and requirements are compatible. # Check that the constraints and requirements are compatible.
print('\nChecking %s' % args.global_requirements) print('\nChecking %s' % args.global_requirements)
global_reqs = read_requirements_file(args.global_requirements) global_reqs = read_requirements_file(args.global_requirements)
for msg in constraints.check_compatible(global_reqs, upper_constraints): for msg in constraints.check_compatible(global_reqs, constraints_txt):
print(msg) print(msg)
error_count += 1 error_count += 1
@ -83,10 +84,9 @@ def main():
# appear in exactly one of the constraints file or the blacklist. # appear in exactly one of the constraints file or the blacklist.
print('\nChecking %s' % args.blacklist) print('\nChecking %s' % args.blacklist)
blacklist = read_requirements_file(args.blacklist) blacklist = read_requirements_file(args.blacklist)
for msg in constraints.check_blacklist_coverage(global_reqs, for msg in constraints.check_blacklist_coverage(
upper_constraints, global_reqs, constraints_txt, blacklist,
blacklist, os.path.basename(args.upper_constraints)):
'upper-constraints.txt'):
print(msg) print(msg)
error_count += 1 error_count += 1

View File

@ -50,8 +50,8 @@ def check_blacklist_coverage(global_reqs, constraints, blacklist,
# the constraints file. # the constraints file.
dupes = constrained.intersection(set(blacklist.keys())) dupes = constrained.intersection(set(blacklist.keys()))
for d in dupes: for d in dupes:
yield ('%r appears in both blacklist.txt and upper-constraints.txt' yield ('%r appears in both blacklist.txt and %s'
% d) % (d, constraints_list_name))
def check_format(parsed_constraints): def check_format(parsed_constraints):
@ -71,8 +71,8 @@ def check_compatible(global_reqs, constraints):
those constraints. those constraints.
* Load global-requirements * Load global-requirements
* Load upper-constraints.txt * Load given constraints.txt
* Check that every version within upper-constraints.txt is either * Check that every version within given constraints.txt is either
A) Missing from global-requirements - its a transitive dep or A) Missing from global-requirements - its a transitive dep or
a removed dep. a removed dep.
@ -83,7 +83,7 @@ def check_compatible(global_reqs, constraints):
requirements is good enough proxy to catch most cases. requirements is good enough proxy to catch most cases.
:param global_reqs: A set of global requirements after parsing. :param global_reqs: A set of global requirements after parsing.
:param constraints: The same from upper-constraints.txt. :param constraints: The same from given constraints.txt.
:return: A list of the error messages for constraints that failed. :return: A list of the error messages for constraints that failed.
""" """
def satisfied(reqs, name, version, failures): def satisfied(reqs, name, version, failures):