diff options
Diffstat (limited to 'meta')
-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: |