]> code.ossystems Code Review - openembedded-core.git/commitdiff
oescripts.py: avoid error when cairo module is not available
authorChen Qi <Qi.Chen@windriver.com>
Fri, 14 Jun 2019 06:32:18 +0000 (14:32 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 14 Jun 2019 21:47:43 +0000 (22:47 +0100)
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 <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/oescripts.py

index 217afe3775b1157d72463a13431b5840a5fb0fd8..7770b66a2629d18af3f5fc3d2bb490ffb4e47fe7 100644 (file)
@@ -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]