Skip to content

Commit

Permalink
squash: catch if list isn't only strings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszachy committed May 14, 2024
1 parent d17cecc commit 5de1c69
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fmf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ def _merge_regexp(self, data, key, value):
value = [value]
for pattern, repl in [utils.split_pattern_repl(v) for v in value]:
if isinstance(data[key], list):
data[key] = [re.sub(pattern, repl, original) for original in data[key]]
try:
data[key] = [re.sub(pattern, repl, original) for original in data[key]]
except TypeError:
raise utils.MergeError(
"MergeError: Key '{0}' in {1} (not a string).".format(
key, self.name))
elif isinstance(data[key], str):
data[key] = re.sub(pattern, repl, data[key])
else:
Expand Down

0 comments on commit 5de1c69

Please sign in to comment.