From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 42C4AE00A9A; Tue, 11 Aug 2015 06:07:55 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.212.177 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id D68B3E00A92 for ; Tue, 11 Aug 2015 06:07:50 -0700 (PDT) Received: by wicne3 with SMTP id ne3so60004064wic.0 for ; Tue, 11 Aug 2015 06:07:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Wp7PKw527SZ+NvFpMrcSDQfc7CRyLnOXSdkkGIhy6js=; b=BxmaEcxDBjBxyZpmES63IUAd+cqT755v7fl80YPaGqIIs6gJLu/1sBXeIjnevs5ClW QQUd3QCeUFr7On7ElE96A9O0g+CN4nDiCPuUz+M6JuP7WQxI8ddr2/XeO7HGLCfVmoAu i4BfrvpfUdVGyJBi/qlv1hua84tuvfSykTlD7i1XI7AYeroysMOG4QaOZBmNkn6pWObU wAwN/Y1yOKYcPQhRokEAOV8ybAZEOY98XqRB4VXEu8AvSoo7wBQ7FBZXlv9H/uXfq5+9 IYH4WmzCZN++AJn78gxzrgf4P5J4Tb640hP4SUv0bIUZE6/BSZXPM4SGAcEKQj/vRwqz eOaQ== X-Gm-Message-State: ALoCoQnlMm7to5qs35NYfEiW6bwd586ws8gGv0HRtJepoDQjU4FgZ3e43rzqzHX32ggyxiy4iUDf X-Received: by 10.194.205.170 with SMTP id lh10mr59831907wjc.1.1439298469952; Tue, 11 Aug 2015 06:07:49 -0700 (PDT) Received: from [192.168.0.30] ([90.200.212.221]) by smtp.googlemail.com with ESMTPSA id bi6sm2962023wjc.25.2015.08.11.06.07.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 06:07:49 -0700 (PDT) Message-ID: <55C9F3A1.1020502@intel.com> Date: Tue, 11 Aug 2015 14:07:45 +0100 From: Michael Wood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: toaster@yoctoproject.org References: In-Reply-To: Subject: Re: [PATCH 9/9] toaster: don't catch json.load exceptions X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2015 13:07:55 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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")