[Piglit] [PATCH 3/3] framework/log.py: bugfix: logger recives status object

Dylan Baker baker.dylan.c at gmail.com
Tue Sep 16 14:46:58 PDT 2014


In the event that a test does not reach the point of returning a status
either via interpret_result() or by an early return, the result passed
to the logger will be the default, which is a Status object. This would
cause an assertion to be triggered that the status was not in the list
of accepted statuses.

This patch corrects this by explicitly transforming the status into a
str (via the str() method).

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

diff --git a/framework/log.py b/framework/log.py
index e0f8cf6..4575707 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -117,6 +117,8 @@ class Log(object):
         # increment the number of completed tests
         self.__complete += 1
 
+        # In some cases result can be a framework.status.Status() instance
+        result = str(result)
         assert result in self.__summary_keys, 'Result "{0}" not in {1}'.format(
             result, self.__summary_keys)
         self.__summary[result] += 1
@@ -129,6 +131,8 @@ class Log(object):
         over it.
 
         """
+        # In some cases result can be a framework.status.Status() instance
+        result = str(result)
         assert result in self.__summary_keys, 'Result "{0}" not in {1}'.format(
             result, self.__summary_keys)
         self.__print(name, result)
-- 
2.1.0



More information about the Piglit mailing list