Report syntax errors as unhandled exceptions
Update tests accordingly
This commit is contained in:
parent
ce8b457bac
commit
b59a7cdcc0
@ -419,7 +419,7 @@ def read_config_py(filename, raising=False):
|
||||
desc = configexc.ConfigErrorDesc("Error while compiling", e)
|
||||
raise configexc.ConfigFileErrors(basename, [desc])
|
||||
except SyntaxError as e:
|
||||
desc = configexc.ConfigErrorDesc("Syntax Error", e,
|
||||
desc = configexc.ConfigErrorDesc("Unhandled exception", e,
|
||||
traceback=traceback.format_exc())
|
||||
raise configexc.ConfigFileErrors(basename, [desc])
|
||||
|
||||
|
@ -550,7 +550,7 @@ class TestConfigPy:
|
||||
assert len(excinfo.value.errors) == 1
|
||||
error = excinfo.value.errors[0]
|
||||
assert isinstance(error.exception, SyntaxError)
|
||||
assert error.text == "Syntax Error"
|
||||
assert error.text == "Unhandled exception"
|
||||
exception_text = 'invalid syntax (config.py, line 1)'
|
||||
assert str(error.exception) == exception_text
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user