[gnome-continuous-yocto/gnomeostree-3.28-rocko: 8167/8267] oeqa/core/loader: Make _built_modules_dict() support packages correctly
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 8167/8267] oeqa/core/loader: Make _built_modules_dict() support packages correctly
- Date: Sun, 17 Dec 2017 07:16:18 +0000 (UTC)
commit 55d21c7fb6ba383057d08c20f6aea66a462ae574
Author: Peter Kjellerstedt <peter kjellerstedt axis com>
Date: Fri Sep 29 18:06:11 2017 +0200
oeqa/core/loader: Make _built_modules_dict() support packages correctly
For test modules in a package, e.g., oelib.license, running
`oe-selftest -r oelib.license` or `oe-selftest -r
oelib.license.TestSimpleCombinations` would fail with a message that
the specified test cases could not be found. This was due to the
parsing in _built_modules_dict(), which failed to distinguish between
<package>.<module>.<class> and <module>.<class>.<testcase> and treated
both cases as the latter.
(From OE-Core rev: 8d5eb5498975fd0d73ac20e2c4d938c1f85317d7)
Signed-off-by: Peter Kjellerstedt <peter kjellerstedt axis com>
Signed-off-by: Ross Burton <ross burton intel com>
Signed-off-by: Armin Kuster <akuster mvista com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
meta/lib/oeqa/core/loader.py | 50 +++++++++++------------------------------
1 files changed, 14 insertions(+), 36 deletions(-)
---
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
index 332086a..975a081 100644
--- a/meta/lib/oeqa/core/loader.py
+++ b/meta/lib/oeqa/core/loader.py
@@ -2,6 +2,7 @@
# Released under the MIT license (see COPYING.MIT)
import os
+import re
import sys
import unittest
import inspect
@@ -39,42 +40,19 @@ def _built_modules_dict(modules):
if modules == None:
return modules_dict
- for m in modules:
- ms = m.split('.')
-
- if len(ms) == 1:
- module_name = ms[0]
- if not module_name in modules_dict:
- modules_dict[module_name] = {}
- elif len(ms) == 2:
- module_name = ms[0]
- class_name = ms[1]
- if not module_name in modules_dict:
- modules_dict[module_name] = {}
- if not class_name in modules_dict[module_name]:
- modules_dict[module_name][class_name] = []
- elif len(ms) == 3:
- module_name = ms[0]
- class_name = ms[1]
- test_name = ms[2]
-
- if not module_name in modules_dict:
- modules_dict[module_name] = {}
- if not class_name in modules_dict[module_name]:
- modules_dict[module_name][class_name] = []
- if not test_name in modules_dict[module_name][class_name]:
- modules_dict[module_name][class_name].append(test_name)
- elif len(ms) >= 4:
- module_name = '.'.join(ms[0:-2])
- class_name = ms[-2]
- test_name = ms[-1]
-
- if not module_name in modules_dict:
- modules_dict[module_name] = {}
- if not class_name in modules_dict[module_name]:
- modules_dict[module_name][class_name] = []
- if not test_name in modules_dict[module_name][class_name]:
- modules_dict[module_name][class_name].append(test_name)
+ for module in modules:
+ # Assumption: package and module names do not contain upper case
+ # characters, whereas class names do
+ m = re.match(r'^([^A-Z]+)(?:\.([A-Z][^.]*)(?:\.([^.]+))?)?$', module)
+
+ module_name, class_name, test_name = m.groups()
+
+ if module_name and module_name not in modules_dict:
+ modules_dict[module_name] = {}
+ if class_name and class_name not in modules_dict[module_name]:
+ modules_dict[module_name][class_name] = []
+ if test_name and test_name not in modules_dict[module_name][class_name]:
+ modules_dict[module_name][class_name].append(test_name)
return modules_dict
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]