[oe-commits] [openembedded-core] 03/08: oeqa: avoid class setup method to run when skipping the whole class
git at git.openembedded.org
git at git.openembedded.org
Fri Jun 21 14:32:57 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master
in repository openembedded-core.
commit b0b79bf65f5e5e65958090a4a88622b42df896bf
Author: Chen Qi <Qi.Chen at windriver.com>
AuthorDate: Fri Jun 21 09:18:03 2019 +0800
oeqa: avoid class setup method to run when skipping the whole class
For now, even if we have specified to skip the whole module/class via
command line, e.g., `oe-selftest -R gotoolchain', the class setup method
is still run. This at least results in unnecessary builds, and at worst
results in ERROR, if the setup method fails.
So improve the skipping mechanism to avoid class setup method to run
when specified to skip.
Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/lib/oeqa/core/case.py | 2 ++
meta/lib/oeqa/core/context.py | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/meta/lib/oeqa/core/case.py b/meta/lib/oeqa/core/case.py
index 54977c8..aca144e 100644
--- a/meta/lib/oeqa/core/case.py
+++ b/meta/lib/oeqa/core/case.py
@@ -32,6 +32,8 @@ class OETestCase(unittest.TestCase):
@classmethod
def _oeSetUpClass(clss):
_validate_td_vars(clss.td, clss.td_vars, "class")
+ if hasattr(clss, 'setUpHooker') and callable(getattr(clss, 'setUpHooker')):
+ clss.setUpHooker()
clss.setUpClassMethod()
@classmethod
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 7882697..68819cc 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -50,10 +50,18 @@ class OETestContext(object):
def func():
raise unittest.SkipTest(skipmsg)
return func
+ class_ids = {}
for test in self.suites:
+ if test.__class__ not in class_ids:
+ class_ids[test.__class__] = '.'.join(test.id().split('.')[:-1])
for skip in skips:
if (test.id()+'.').startswith(skip+'.'):
setattr(test, 'setUp', skipfuncgen('Skip by the command line argument "%s"' % skip))
+ for tclass in class_ids:
+ cid = class_ids[tclass]
+ for skip in skips:
+ if (cid + '.').startswith(skip + '.'):
+ setattr(tclass, 'setUpHooker', skipfuncgen('Skip by the command line argument "%s"' % skip))
def loadTests(self, module_paths, modules=[], tests=[],
modules_manifest="", modules_required=[], filters={}):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list