Add TestFail, TestError and TestCancel to the avocado namespace
In many cases when you are developing a test suite using
avocado libraries, you want to flag certain exceptional
conditions as real test failures, rather than something
that will be converted to an ERROR status (the current
default behavior).
Consider QEMU testing: An exception involving a QEMU core
dump should be considered a failure in pretty much every
scenario one can think of. So it makes sense to have code
similar to:
from avocado import TestFail
QEMUCoreDump(TestFail):
pass
so that when said exception happens inside library code,
the test can be immediately flagged as a failure, without
having to introduce boilerplate code to check for error
conditions.
So at least the 3 main test related exceptions (TestFail,
TestError and TestCancel) should be directly exposed in
the test writer API. Methods such as self.fail() are
neat shortcuts for simpler cases and should be used,
but entirely isolating access to *all* avocado exceptions
is detrimental to the goal of reducing boilerplate code
in tests.
This patch adds the mentioned 3 test exceptions to the
avocado namespace, making them part of the test writer
API.
Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
Showing
想要评论请 注册 或 登录