Skip to content

Commit

Permalink
Merge pull request #5985 from richtja/settings_exception_fix
Browse files Browse the repository at this point in the history
Better description of config syntax error
  • Loading branch information
richtja authored Jul 31, 2024
2 parents 34b427e + 6f39aa6 commit 698e9d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions avocado/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ def _as_list(value):
return []

if isinstance(value, str):
return ast.literal_eval(value)
try:
return ast.literal_eval(value)
except SyntaxError:
pass

if isinstance(value, list):
return value
Expand Down Expand Up @@ -628,7 +631,7 @@ def merge_with_configs(self):
value = value[0]
try:
self.update_option(namespace, value, convert=True)
except SyntaxError:
except (SyntaxError, ValueError):
raise SyntaxError(
f"Syntax error in config file {path}, please check the value {value} "
)
Expand Down

0 comments on commit 698e9d3

Please sign in to comment.