Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better description of config syntax error #5985

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading