[bitbake-devel] [PATCH 08/11] toaster: don't catch json.load exceptions

Michael Wood michael.g.wood at intel.com
Mon Aug 10 17:27:15 UTC 2015


From: Ed Bartosh <ed.bartosh at linux.intel.com>

It doesn't make sense to catch json.load exceptions in the
testing code. If API throws traceback it's better to see
it instead of error message.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
 lib/toaster/toastergui/tests.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/lib/toaster/toastergui/tests.py b/lib/toaster/toastergui/tests.py
index 1ed83dc..723348d 100644
--- a/lib/toaster/toastergui/tests.py
+++ b/lib/toaster/toastergui/tests.py
@@ -82,10 +82,7 @@ class ViewTests(TestCase):
         self.assertEqual(response.status_code, 200)
         self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-        try:
-            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")
@@ -113,10 +110,8 @@ class ViewTests(TestCase):
             self.assertEqual(response.status_code, 200)
             self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-            try:
-                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")
             self.assertTrue("results" in data)
-- 
2.1.4




More information about the bitbake-devel mailing list