[OE-core] [PATCH 1/3] test-utils: handle import bb failing and skip the test

Richard Purdie richard.purdie at linuxfoundation.org
Thu May 30 19:49:13 UTC 2013


On Thu, 2013-05-23 at 19:44 +0100, Ross Burton wrote:
> Instead of reporting an error when bb cannot be imported, skip the test
> instead. This makes it a lot easier to iterate a test suite when we don't care
> about this particular test.
> 
> Signed-off-by: Ross Burton <ross.burton at intel.com>
> ---
>  meta/lib/oe/tests/test_utils.py |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/tests/test_utils.py b/meta/lib/oe/tests/test_utils.py
> index 466c47e..779247a 100644
> --- a/meta/lib/oe/tests/test_utils.py
> +++ b/meta/lib/oe/tests/test_utils.py
> @@ -1,11 +1,15 @@
>  import unittest
> -import bb, oe.utils
> +import oe.utils
>  
>  class TestPackagesFilterOutSystem(unittest.TestCase):
>      def test_filter(self):
>          """
>          Test that oe.utils.packages_filter_out_system works.
>          """
> +        try:
> +            import bb
> +        except ImportError:
> +            self.skipTest("Cannot import bb")
>  
>          d = bb.data_smart.DataSmart()
>          d.setVar("PN", "foo")

This a python 2.7ism :(

For various reasons we should really add unittest from python 2.7 into
bitbake and solve this problem that way once and for all. I appreciate
that adds a hard dependency on using bitbake but OE isn't much use
without it...

Cheers,

Richard




More information about the Openembedded-core mailing list