All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Yeoh Ee Peng <ee.peng.yeoh@intel.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/5] oeqa/core/runner: refactor for OEQA to write json testresult
Date: Mon, 15 Oct 2018 09:25:19 +0100	[thread overview]
Message-ID: <9d6783fcc08d063e63a44f8dc5b9048ce2a698f2.camel@linuxfoundation.org> (raw)
In-Reply-To: <1539588294-5532-1-git-send-email-ee.peng.yeoh@intel.com>

On Mon, 2018-10-15 at 15:24 +0800, Yeoh Ee Peng wrote:
> Refactor the original _getDetailsNotPassed method to return
> testresult details (test status and log), which will be reused
> by future OEQA code to write json testresult.
> 
> Take the opportunity to consolidate and simplify the logic used
> to gather test status and log within the TestResult instance.
> 
> Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
> ---
>  meta/lib/oeqa/core/runner.py | 70 ++++++++++++++++++--------------------------
>  1 file changed, 29 insertions(+), 41 deletions(-)
> 
> diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
> index eeb625b..56666ee 100644
> --- a/meta/lib/oeqa/core/runner.py
> +++ b/meta/lib/oeqa/core/runner.py
> @@ -76,40 +76,43 @@ class OETestResult(_TestResult):
>          else:
>              msg = "%s - FAIL - Required tests failed" % component
>          skipped = len(self.skipped)
> -        if skipped: 
> +        if skipped:
>              msg += " (skipped=%d)" % skipped
>          self.tc.logger.info(msg)
>  
> -    def _getDetailsNotPassed(self, case, type, desc):
> -        found = False
> +    def _getTestResultDetails(self, case):
> +        result_types = ['failures', 'errors', 'skipped', 'expectedFailures', 'successes']
> +        result_desc = ['FAILED', 'ERROR', 'SKIPPED', 'EXPECTEDFAIL', 'PASSED']

This patch is much better thanks! 

It could still do with one more minor tweak. You can use a dict above
to simplfy this code and avoid using indexes which is not very
pythonic, for example


result_types = {'failures' : 'FAILED', 'errors' : 'ERROR'}

then

for rtype in result_types:
    [...]
    return result_types[rtype], msg


The rest of the patch looks like a nice simplification now though!

Cheers,

Richard



  parent reply	other threads:[~2018-10-15  8:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  7:24 [PATCH 1/5] oeqa/core/runner: refactor for OEQA to write json testresult Yeoh Ee Peng
2018-10-15  7:24 ` [PATCH 2/5] oeqa/core/runner: write testresult to json files Yeoh Ee Peng
2018-10-15  8:53   ` Richard Purdie
2018-10-15 10:20     ` Yeoh, Ee Peng
2018-10-18  9:47     ` Yeoh, Ee Peng
2018-10-18 21:56       ` richard.purdie
2018-10-20  1:50         ` Yeoh, Ee Peng
2018-10-22  7:23         ` Yeoh, Ee Peng
2018-10-22  8:17         ` Yeoh, Ee Peng
2018-10-22  8:52           ` richard.purdie
2018-10-15  7:24 ` [PATCH 3/5] oeqa/selftest/context: " Yeoh Ee Peng
2018-10-15  7:24 ` [PATCH 4/5] testimage.bbclass: " Yeoh Ee Peng
2018-10-15  7:24 ` [PATCH 5/5] testsdk.bbclass: " Yeoh Ee Peng
2018-10-15  8:25 ` Richard Purdie [this message]
2018-10-15  8:47   ` [PATCH 1/5] oeqa/core/runner: refactor for OEQA to write json testresult Yeoh, Ee Peng
2018-10-18  9:11 Yeoh Ee Peng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d6783fcc08d063e63a44f8dc5b9048ce2a698f2.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=ee.peng.yeoh@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.