[OE-core] [PATCH 1/1] testsdk.bbclass: check python module testools and subunit

Robert Yang liezhi.yang at windriver.com
Fri Jul 27 08:37:44 UTC 2018



On 07/27/2018 11:29 AM, Robert Yang wrote:
> The testools or subunit is not part of python's standard library, so check them
> before use.
> 
> Fixed when they are not installed on host:
> $ bitbake core-image-minimal -ctestsdk
> Exception: ImportError: No module named 'testtools'
> 
> Now it can run with a warning:
> WARNING: core-image-minimal-1.0-r0 do_testsdk: Failed to import testools or subunit, the testcases will run serially
> 
> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> ---
>   meta/classes/testsdk.bbclass | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
> index 5df17bf..4f86998 100644
> --- a/meta/classes/testsdk.bbclass
> +++ b/meta/classes/testsdk.bbclass
> @@ -43,6 +43,12 @@ def testsdk_main(d):
>           d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"))
>   
>       processes = d.getVar("TESTIMAGE_NUMBER_THREADS") or d.getVar("BB_NUMBER_THREADS")
> +    if processes:
> +        try:
> +            import testools, subunit
> +        except ImportError:
> +            bb.warn("Failed to import testools or subunit, the testcases will run serially")

Sorry, typos, they should be "testtools" (lacks of a t), I fixed them in
the repo, also fixed in the commit message.

// Robert

> +            processes = None
>   
>       sdk_dir = d.expand("${WORKDIR}/testimage-sdk/")
>       bb.utils.remove(sdk_dir, True)
> 



More information about the Openembedded-core mailing list