]> code.ossystems Code Review - openembedded-core.git/commit
oescripts.py: use unittest.SkipUnless for class skip
authorTrevor Gamblin <trevor.gamblin@windriver.com>
Thu, 5 Dec 2019 16:55:19 +0000 (11:55 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 19 Feb 2020 22:15:14 +0000 (22:15 +0000)
commit10c2216cb6fb61c74babd8bd17cb3481754b7475
treea0be30b9ec8ccf55600d00f6f62b0672f8c0526a
parent8f29d82202898ff1604abd7a9d56a487bf120f54
oescripts.py: use unittest.SkipUnless for class skip

Yocto Bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13663

Prior to this fix, the try/except block in OEScriptTests' setUpClass
did both the import and the raise unittest.SkipTest for the
subsequent OEPybootchartguyTests. The consequence of the this meant
that, when cairo was not available on the test host, the raise was
counted only once as a class setup issue, instead of once for each
of the tests to be run, resulting in incorrect skip counts in the
test results.

Instead of raising unittest.SkipTest in setUpClass, the more
proper method is to use the unittest.skipUnless method along with
importlib.util.find_spec to check for the presence of the
python3-cairo module. This allows the entire class to be skipped
if cairo is not present, while also correctly passing along the
skip state for each of the class's tests, and avoiding the UNKNOWN
results to appear in cases where the -j option was provided to
oe-selftest, but the tests were still skipped.

Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/selftest/cases/oescripts.py