提交 59aa3327 编写于 作者: L Lukáš Doktor

avocado.loader: Avoid uncaught exceptions while discovering jobs

Some very ugly modules use sys.exit() on imports. These are not catched
by Exception thus BaseException is required.

I did not omit KeyboardInterrupt as users get mad when ctrl+c doesn't
work. On the other hand nasty python code raising KeyboardInterrupt on
import can interrupt test-discovery (avocado list nasty.py => Interrupted
by user)
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 acc19e88
......@@ -135,7 +135,9 @@ class TestLoader(object):
# Since a lot of things can happen here, the broad exception is
# justified. The user will get it unadulterated anyway, and avocado
# will not crash.
except Exception, details:
except BaseException, details: # Ugly python files can raise any exc
if isinstance(details, KeyboardInterrupt):
raise # Don't ignore ctrl+c
if os.access(test_path, os.X_OK):
# Module can't be imported, and it's executable. Let's try to
# execute it.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册