diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2017-03-27 13:05:24 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-28 08:43:12 +0100 |
commit | c711caae831959f4722bec4de98f36507efceccd (patch) | |
tree | 4e6c466bd7953a077076fbb7309e7072406a9552 /meta/lib/oeqa | |
parent | 71e48a361731dda62a05c8ef79691b80a3561596 (diff) | |
download | poky-c711caae831959f4722bec4de98f36507efceccd.tar.gz |
oeqa/core/loader.py: Do not import underscore modules by default
Underscore modules are meant to be run only when manually added to the test
suite, so far another mechanisms are in place to make this happen with
runtime, sdk, and esdk (mostly in test* bbclasses).
This will add such functionality in the core framework so other specific
frameworks can take use this without adding something else.
[YOCTO #10980]
(From OE-Core rev: 2c6eac774768aa610a8b3784483b9e90fb629c2d)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/core/loader.py | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index 74f1117825..63a1703536 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py | |||
@@ -223,8 +223,21 @@ class OETestLoader(unittest.TestLoader): | |||
223 | msg = 'Tried to import %s test module but is a built-in' | 223 | msg = 'Tried to import %s test module but is a built-in' |
224 | raise ImportError(msg % module.__name__) | 224 | raise ImportError(msg % module.__name__) |
225 | 225 | ||
226 | if not self.modules or "all" in self.modules or \ | 226 | # Normal test modules are loaded if no modules were specified, |
227 | module.__name__ in self.modules: | 227 | # if module is in the specified module list or if 'all' is in |
228 | # module list. | ||
229 | # Underscore modules are loaded only if specified in module list. | ||
230 | load_module = True if not module.__name__.startswith('_') \ | ||
231 | and (not self.modules \ | ||
232 | or module.__name__ in self.modules \ | ||
233 | or 'all' in self.modules) \ | ||
234 | else False | ||
235 | |||
236 | load_underscore = True if module.__name__.startswith('_') \ | ||
237 | and module.__name__ in self.modules \ | ||
238 | else False | ||
239 | |||
240 | if load_module or load_underscore: | ||
228 | return super(OETestLoader, self).loadTestsFromModule( | 241 | return super(OETestLoader, self).loadTestsFromModule( |
229 | module, *args, pattern=pattern, **kws) | 242 | module, *args, pattern=pattern, **kws) |
230 | else: | 243 | else: |
@@ -238,8 +251,21 @@ class OETestLoader(unittest.TestLoader): | |||
238 | msg = 'Tried to import %s test module but is a built-in' | 251 | msg = 'Tried to import %s test module but is a built-in' |
239 | raise ImportError(msg % module.__name__) | 252 | raise ImportError(msg % module.__name__) |
240 | 253 | ||
241 | if not self.modules or "all" in self.modules or \ | 254 | # Normal test modules are loaded if no modules were specified, |
242 | module.__name__ in self.modules: | 255 | # if module is in the specified module list or if 'all' is in |
256 | # module list. | ||
257 | # Underscore modules are loaded only if specified in module list. | ||
258 | load_module = True if not module.__name__.startswith('_') \ | ||
259 | and (not self.modules \ | ||
260 | or module.__name__ in self.modules \ | ||
261 | or 'all' in self.modules) \ | ||
262 | else False | ||
263 | |||
264 | load_underscore = True if module.__name__.startswith('_') \ | ||
265 | and module.__name__ in self.modules \ | ||
266 | else False | ||
267 | |||
268 | if load_module or load_underscore: | ||
243 | return super(OETestLoader, self).loadTestsFromModule( | 269 | return super(OETestLoader, self).loadTestsFromModule( |
244 | module, use_load_tests) | 270 | module, use_load_tests) |
245 | else: | 271 | else: |