* [PATCH 0/2] oeqa: two fixes regarding skipping tests @ 2019-06-21 1:18 Chen Qi 2019-06-21 1:18 ` [PATCH 1/2] context.py: avoid skipping tests by meaningless command argument Chen Qi 2019-06-21 1:18 ` [PATCH 2/2] oeqa: avoid class setup method to run when skipping the whole class Chen Qi 0 siblings, 2 replies; 3+ messages in thread From: Chen Qi @ 2019-06-21 1:18 UTC (permalink / raw) To: openembedded-core *** BLURB HERE *** The following changes since commit 1d60af733cc28018ce95789191986e3ce6c3b86d: python3: python3: Fix build error x86->x86 (2019-06-19 22:13:42 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib ChenQi/oeqa-skip-class http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/oeqa-skip-class Chen Qi (2): context.py: avoid skipping tests by meaningless command argument oeqa: avoid class setup method to run when skipping the whole class meta/lib/oeqa/core/case.py | 2 ++ meta/lib/oeqa/core/context.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) -- 1.9.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] context.py: avoid skipping tests by meaningless command argument 2019-06-21 1:18 [PATCH 0/2] oeqa: two fixes regarding skipping tests Chen Qi @ 2019-06-21 1:18 ` Chen Qi 2019-06-21 1:18 ` [PATCH 2/2] oeqa: avoid class setup method to run when skipping the whole class Chen Qi 1 sibling, 0 replies; 3+ messages in thread From: Chen Qi @ 2019-06-21 1:18 UTC (permalink / raw) To: openembedded-core Currently `oe-selftest -R a' will skip 'archiver' tests. This is not expected. Fix it so that the '-R' should be followed by actual module/class/test names. Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- meta/lib/oeqa/core/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py index 5824489..7882697 100644 --- a/meta/lib/oeqa/core/context.py +++ b/meta/lib/oeqa/core/context.py @@ -52,7 +52,7 @@ class OETestContext(object): return func for test in self.suites: for skip in skips: - if test.id().startswith(skip): + if (test.id()+'.').startswith(skip+'.'): setattr(test, 'setUp', skipfuncgen('Skip by the command line argument "%s"' % skip)) def loadTests(self, module_paths, modules=[], tests=[], -- 1.9.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] oeqa: avoid class setup method to run when skipping the whole class 2019-06-21 1:18 [PATCH 0/2] oeqa: two fixes regarding skipping tests Chen Qi 2019-06-21 1:18 ` [PATCH 1/2] context.py: avoid skipping tests by meaningless command argument Chen Qi @ 2019-06-21 1:18 ` Chen Qi 1 sibling, 0 replies; 3+ messages in thread From: Chen Qi @ 2019-06-21 1:18 UTC (permalink / raw) To: openembedded-core 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@windriver.com> --- 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={}): -- 1.9.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-21 1:06 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-21 1:18 [PATCH 0/2] oeqa: two fixes regarding skipping tests Chen Qi 2019-06-21 1:18 ` [PATCH 1/2] context.py: avoid skipping tests by meaningless command argument Chen Qi 2019-06-21 1:18 ` [PATCH 2/2] oeqa: avoid class setup method to run when skipping the whole class Chen Qi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox