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 <[email protected]>
---
 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

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to