From 785bb108ceb9dc137ec8d75d887b6a3869cbfb9c Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Fri, 14 Jun 2019 14:32:18 +0800 Subject: oescripts.py: avoid error when cairo module is not available When running 'oe-selftest -r oescripts', the following error appeared. cls.skipTest('Python module cairo is not present') TypeError: skipTest() missing 1 required positional argument: 'reason' This is because the host does not have the cairo python module installed. Fix this problem by using unittest's SkipTest exception. Signed-off-by: Chen Qi Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/oescripts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index 217afe3775..7770b66a26 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py @@ -3,6 +3,7 @@ # import os +import unittest from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.cases.buildhistory import BuildhistoryBase from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer @@ -38,7 +39,7 @@ class OEScriptTests(OESelftestTestCase): try: import cairo except ImportError: - cls.skipTest('Python module cairo is not present') + raise unittest.SkipTest('Python module cairo is not present') bitbake("core-image-minimal -c rootfs -f") cls.tmpdir = get_bb_var('TMPDIR') cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] -- cgit 1.2.3-korg