Update tests

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial
2019-10-24 14:13:24 +02:00
parent aaedfb35dd
commit df1ba933de
4 changed files with 641 additions and 27 deletions

View File

@@ -52,7 +52,7 @@ def get_hashed_config_list(conf):
def get_conf_line_hash(line):
"""
Removes whitespace, lowercases, comments and sorts cache params if present.
Removes whitespace, lowercases, comments and sorts params if present.
Returns empty line for comment-only lines
We don't care about order of params and kinds of whitespace in config lines
@@ -60,15 +60,15 @@ def get_conf_line_hash(line):
testing we pretend we don't.
"""
def sort_cache_params(params):
def sort_params(params):
return ",".join(sorted(params.split(",")))
line = line.split("#")[0]
cache_params_pattern = re.compile(r"(.*?\s)(\S+=\S+)")
match = cache_params_pattern.search(line)
params_pattern = re.compile(r"(.*?\s)(\S+=\S+)")
match = params_pattern.search(line)
if match:
sorted_params = sort_cache_params(match.group(2))
sorted_params = sort_params(match.group(2))
line = match.group(1) + sorted_params
return "".join(line.lower().split())