All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Wood <michael.g.wood@intel.com>
To: toaster@yoctoproject.org
Subject: Re: [PATCH 9/9] toaster: don't catch json.load exceptions
Date: Tue, 11 Aug 2015 14:07:45 +0100	[thread overview]
Message-ID: <55C9F3A1.1020502@intel.com> (raw)
In-Reply-To: <a48109a2ca098cd49f4290670882edcae4162f18.1438855858.git.ed.bartosh@linux.intel.com>

Thanks - Submitted upstream (with the additional patches post-rebase)

On 06/08/15 11:15, Ed Bartosh wrote:
> It doesn't make sense to catch json.load exceptions in the
> testing code. It's not a production code and if it fails
> because some API doesn't return json code it's better to
> see full traceback.
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>   bitbake/lib/toaster/toastergui/tests.py | 14 ++++----------
>   1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
> index a549a02..a38cdab 100644
> --- a/bitbake/lib/toaster/toastergui/tests.py
> +++ b/bitbake/lib/toaster/toastergui/tests.py
> @@ -21,6 +21,8 @@
>   
>   """Test cases for Toaster GUI and ReST."""
>   
> +import json
> +
>   from django.test import TestCase
>   from django.core.urlresolvers import reverse
>   from orm.models import Project, Release, BitbakeVersion
> @@ -69,11 +71,7 @@ class ViewTests(TestCase):
>           self.assertEqual(response.status_code, 200)
>           self.assertTrue(response['Content-Type'].startswith('application/json'))
>   
> -        try:
> -            import json
> -            data = json.loads(response.content)
> -        except:
> -            self.fail("Response %s is not json-loadable" % response.content)
> +        data = json.loads(response.content)
>   
>           self.assertTrue("error" in data)
>           self.assertEqual(data["error"], "ok")
> @@ -92,11 +90,7 @@ class ViewTests(TestCase):
>           self.assertEqual(response.status_code, 200)
>           self.assertTrue(response['Content-Type'].startswith('application/json'))
>   
> -        try:
> -            import json
> -            data = json.loads(response.content)
> -        except:
> -            self.fail("Response %s is not json-loadable" % response.content)
> +        data = json.loads(response.content)
>   
>           self.assertTrue("error" in data)
>           self.assertEqual(data["error"], "ok")



      reply	other threads:[~2015-08-11 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 10:15 [review request] [PATCH 0/9] ed/toaster/fix-toastergui/tests Ed Bartosh
2015-08-06 10:15 ` [PATCH 1/9] toaster: fix test_get_json_call_returns_json test Ed Bartosh
2015-08-06 10:15 ` [PATCH 2/9] toaster: fix test_xhr_datatypeahead_layer test Ed Bartosh
2015-08-06 10:15 ` [PATCH 3/9] toaster: wrap long lines Ed Bartosh
2015-08-06 10:15 ` [PATCH 4/9] toaster: get rid of AllProjectsViewTestCase Ed Bartosh
2015-08-06 10:15 ` [PATCH 5/9] toaster: put all test cases into one class Ed Bartosh
2015-08-06 10:15 ` [PATCH 6/9] toaster: get rid of class attribute LAYER_NAME Ed Bartosh
2015-08-06 10:15 ` [PATCH 7/9] toaster: remove unused import Ed Bartosh
2015-08-06 10:15 ` [PATCH 8/9] toaster: add header and docsting Ed Bartosh
2015-08-06 10:15 ` [PATCH 9/9] toaster: don't catch json.load exceptions Ed Bartosh
2015-08-11 13:07   ` Michael Wood [this message]

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=55C9F3A1.1020502@intel.com \
    --to=michael.g.wood@intel.com \
    --cc=toaster@yoctoproject.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.