[Piglit] [PATCH 13/44] framework/results.py: use compat

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Jan 27 16:06:21 PST 2016


From: Dylan Baker <baker.dylan.c at gmail.com>

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/results.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/framework/results.py b/framework/results.py
index d8a9f16..f0c0a99 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -29,7 +29,7 @@ import datetime
 
 import six
 
-from framework import status, exceptions, grouptools
+from framework import status, exceptions, grouptools, compat
 
 __all__ = [
     'TestrunResult',
@@ -252,13 +252,14 @@ class TestResult(object):
             self.subtests.update(dict_['subtest'])
 
 
+ at compat.python_2_bool_compatible
 class Totals(dict):
     def __init__(self, *args, **kwargs):
         super(Totals, self).__init__(*args, **kwargs)
         for each in status.ALL:
             self[str(each)] = 0
 
-    def __nonzero__(self):
+    def __bool__(self):
         # Since totals are prepopulated, calling 'if not <Totals instance>'
         # will always result in True, this will cause it to return True only if
         # one of the values is not zero
-- 
2.7.0



More information about the Piglit mailing list