From: Mariano Lopez <[email protected]> If importing a test with the same name as a built-in module, it will silently import the built-in and check for tests in built-in module. This happened with syslog module in debian based machines, so add a raise to avoid this behavior.
[YOCTO #10978] Signed-off-by: Mariano Lopez <[email protected]> --- meta/lib/oeqa/core/loader.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index bf13a5a..a28512b 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py @@ -217,6 +217,13 @@ class OETestLoader(unittest.TestLoader): # use_load_tests deprecation via *args and **kws. See issue 16662. if sys.version_info >= (3,5): def loadTestsFromModule(self, module, *args, pattern=None, **kws): + """ + Returns a suite of all tests cases contained in module. + """ + if module.__name__ in sys.builtin_module_names: + msg = 'Tried to import %s test module but is a built-in' + raise ImportError(msg % module.__name__) + if not self.modules or "all" in self.modules or \ module.__name__ in self.modules: return super(OETestLoader, self).loadTestsFromModule( @@ -228,6 +235,10 @@ class OETestLoader(unittest.TestLoader): """ Returns a suite of all tests cases contained in module. """ + if module.__name__ in sys.builtin_module_names: + msg = 'Tried to import %s test module but is a built-in' + raise ImportError(msg % module.__name__) + if not self.modules or "all" in self.modules or \ module.__name__ in self.modules: return super(OETestLoader, self).loadTestsFromModule( -- 2.6.6 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
