From e5dd3516562b17052e07062b4539d4f961a6ac37 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Mon, 26 Sep 2016 19:59:16 -0300 Subject: [PATCH] Result Plugins: handle exceptions when rendering the results Previously, a crash in one result plugin could abort the execution of other plugins and consequently the last parts of the avocado command line application execution. Let's handle exceptions that could be raised there, as it's already being done with Job Pre/Post plugins. Signed-off-by: Cleber Rosa --- avocado/core/dispatcher.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/avocado/core/dispatcher.py b/avocado/core/dispatcher.py index a98a9ee4..8f131359 100644 --- a/avocado/core/dispatcher.py +++ b/avocado/core/dispatcher.py @@ -94,3 +94,17 @@ class ResultDispatcher(Dispatcher): def __init__(self): super(ResultDispatcher, self).__init__('avocado.plugins.result') + + def map_method(self, method_name, result, job): + for ext in self.extensions: + try: + if hasattr(ext.obj, method_name): + method = getattr(ext.obj, method_name) + method(result, job) + except SystemExit: + raise + except KeyboardInterrupt: + raise + except: + job.log.error('Error running method "%s" of plugin "%s": %s', + method_name, ext.name, sys.exc_info()[1]) -- GitLab