From cd3bb9d3ff6c16cf302f62222fafa89420a33bc9 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 8 Mar 2018 10:26:07 +0100 Subject: [PATCH] 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 --- openstack_requirements/cmds/validate.py | 14 +++++++------- openstack_requirements/constraints.py | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openstack_requirements/cmds/validate.py b/openstack_requirements/cmds/validate.py index 6ea27e305b..845ecd6660 100644 --- a/openstack_requirements/cmds/validate.py +++ b/openstack_requirements/cmds/validate.py @@ -15,6 +15,7 @@ """ import argparse +import os from openstack_requirements import constraints from openstack_requirements import requirement @@ -49,15 +50,15 @@ def main(): # Check the format of the constraints file. print('\nChecking %s' % args.upper_constraints) - upper_constraints = read_requirements_file(args.upper_constraints) - for msg in constraints.check_format(upper_constraints): + constraints_txt = read_requirements_file(args.upper_constraints) + for msg in constraints.check_format(constraints_txt): print(msg) error_count += 1 # Check that the constraints and requirements are compatible. print('\nChecking %s' % 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) error_count += 1 @@ -83,10 +84,9 @@ def main(): # appear in exactly one of the constraints file or the blacklist. print('\nChecking %s' % args.blacklist) blacklist = read_requirements_file(args.blacklist) - for msg in constraints.check_blacklist_coverage(global_reqs, - upper_constraints, - blacklist, - 'upper-constraints.txt'): + for msg in constraints.check_blacklist_coverage( + global_reqs, constraints_txt, blacklist, + os.path.basename(args.upper_constraints)): print(msg) error_count += 1 diff --git a/openstack_requirements/constraints.py b/openstack_requirements/constraints.py index 1b4d716bfc..09148b92b5 100644 --- a/openstack_requirements/constraints.py +++ b/openstack_requirements/constraints.py @@ -50,8 +50,8 @@ def check_blacklist_coverage(global_reqs, constraints, blacklist, # the constraints file. dupes = constrained.intersection(set(blacklist.keys())) for d in dupes: - yield ('%r appears in both blacklist.txt and upper-constraints.txt' - % d) + yield ('%r appears in both blacklist.txt and %s' + % (d, constraints_list_name)) def check_format(parsed_constraints): @@ -71,8 +71,8 @@ def check_compatible(global_reqs, constraints): those constraints. * Load global-requirements - * Load upper-constraints.txt - * Check that every version within upper-constraints.txt is either + * Load given constraints.txt + * Check that every version within given constraints.txt is either A) Missing from global-requirements - its a transitive dep or a removed dep. @@ -83,7 +83,7 @@ def check_compatible(global_reqs, constraints): requirements is good enough proxy to catch most cases. :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. """ def satisfied(reqs, name, version, failures):