mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] runbot: default empty value for result
This commit is contained in:
parent
6892546d94
commit
2b8242cf42
@ -930,7 +930,7 @@ class ConfigStep(models.Model):
|
||||
def _make_python_results(self, build):
|
||||
eval_ctx = self.make_python_ctx(build)
|
||||
safe_eval(self.python_result_code.strip(), eval_ctx, mode="exec", nocopy=True)
|
||||
return_value = eval_ctx.get('return_value')
|
||||
return_value = eval_ctx.get('return_value', {})
|
||||
# todo check return_value or write in try except. Example: local result setted to wrong value
|
||||
if not isinstance(return_value, dict):
|
||||
raise RunbotException('python_result_code must set return_value to a dict values on build')
|
||||
|
@ -674,7 +674,7 @@ Initiating shutdown
|
||||
self.assertEqual(result, {'local_result': 'ok'})
|
||||
|
||||
# invalid result code (no return_value set)
|
||||
config_step.python_result_code = """a = 2*5\nr = {'a': 'ok'}"""
|
||||
config_step.python_result_code = """a = 2*5\nr = {'a': 'ok'}\nreturn_value = 'ko'"""
|
||||
with self.assertRaises(RunbotException):
|
||||
result = config_step._make_results(build)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user