[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 18/23] oeqa/selftest/oescripts: refactor skipping logic
From:       "Ross Burton" <ross () burtonini ! com>
Date:       2022-03-31 18:29:10
Message-ID: 20220331182915.22128-18-ross.burton () arm ! com
[Download RAW message or body]

Content-Transfer-Encoding: quoted-printable

OEScriptTests currently skips if cairo isn't present, and does a build
of core-image-minimal.  This is only required for the
OEPybootchartguyTests tests, so move that logic there so that the
OEListPackageconfigTests run even if cairo isn't available.

This leaves OEScriptTests as a simple class containing the scripts_dir
assignment, which can then be reused by other tests to avoid code
duplication.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/lib/oeqa/selftest/cases/oescripts.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py \
b/meta/lib/oeqa/selftest/cases/oescripts.py index b3261e512f5..cd687816c83 100644
--- a/meta/lib/oeqa/selftest/cases/oescripts.py
+++ b/meta/lib/oeqa/selftest/cases/oescripts.py
@@ -34,21 +34,19 @@ class BuildhistoryDiffTests(BuildhistoryBase):
         if expected_endlines:
             self.fail('Missing expected line endings:\n  %s' % '\n  \
'.join(expected_endlines))  
-@unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not \
present")  class OEScriptTests(OESelftestTestCase):
+    scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
+
+@unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not \
present") +class OEPybootchartguyTests(OEScriptTests):
 
     @classmethod
     def setUpClass(cls):
         super(OEScriptTests, cls).setUpClass()
-        import cairo
         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]  
-    scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
-
-class OEPybootchartguyTests(OEScriptTests):
-
     def test_pybootchartguy_help(self):
         runCmd('%s/pybootchartgui/pybootchartgui.py  --help' % self.scripts_dir)
 
@@ -65,9 +63,7 @@ class OEPybootchartguyTests(OEScriptTests):
         self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf"))
 
 
-class OEGitproxyTests(OESelftestTestCase):
-
-    scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
+class OEGitproxyTests(OEScriptTests):
 
     def test_oegitproxy_help(self):
         try:
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163859): https://lists.openembedded.org/g/openembedded-core/message/163859
Mute This Topic: https://lists.openembedded.org/mt/90161355/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic