From d9d44d0c9d60522770e45efcf5cf0820e08383f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Fri, 12 Jun 2015 15:31:43 +0200 Subject: [PATCH] core.loader: Log discover_url exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `discover_url` function should not fail, instead it should return empty results. In case of failure, it's impossible to find out what went wrong as we don't log any details, thus it might happen that `avocado list` shows tests, which are not found during `avocado run`. This patch temporarily logs reason into the `avocado.app.exceptions` and traceback into the `avocado.app.traceback` logger. Booth are enabled by default, but the plan is to make these optional and show only the `exceptions` by default. Signed-off-by: Lukáš Doktor --- avocado/core/loader.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/avocado/core/loader.py b/avocado/core/loader.py index 25bd914e..0c622242 100644 --- a/avocado/core/loader.py +++ b/avocado/core/loader.py @@ -26,7 +26,7 @@ import sys from . import data_dir from . import test from . import output -from ..utils import path +from ..utils import path, stacktrace try: import cStringIO as StringIO @@ -122,8 +122,14 @@ class TestLoaderProxy(object): self.url_plugin_mapping[url] = loader_plugin if loader_plugin == self.url_plugin_mapping[url]: test_factories += loader_plugin.discover(params_list_from_url) - except Exception: - continue + except Exception, details: + # FIXME: Introduce avocado.exceptions logger and use here + stacktrace.log_message("Test discovery plugin %s failed: " + "%s" % (loader_plugin, details), + 'avocado.app.exceptions') + # FIXME: Introduce avocado.traceback logger and use here + stacktrace.log_exc_info(sys.exc_info(), + 'avocado.app.tracebacks') return test_factories def validate_ui(self, test_suite, ignore_missing=False, -- GitLab