[Piglit] [PATCH 30/44] framework/test/base.py: fix compare to None in python 3

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


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

Also fix unittest that relied on compare to None having python 2
behavior.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/test/base.py        | 5 +++++
 unittests/oglconform_tests.py | 1 +
 2 files changed, 6 insertions(+)

diff --git a/framework/test/base.py b/framework/test/base.py
index 159ab50..0fe0f74 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -133,6 +133,11 @@ def is_crash_returncode(returncode):
     """Determine whether the given process return code correspond to a
     crash.
     """
+    # In python 2 NoneType and other types can be compaired, in python3 this
+    # isn't allowed.
+    if returncode is None:
+        return False
+
     if sys.platform == 'win32':
         # On Windows:
         # - For uncaught exceptions the process terminates with the exception
diff --git a/unittests/oglconform_tests.py b/unittests/oglconform_tests.py
index bcc6eae..6dbe40b 100644
--- a/unittests/oglconform_tests.py
+++ b/unittests/oglconform_tests.py
@@ -154,6 +154,7 @@ def test_oglctest_interpret_result_fail():
 def test_oglctest_interpret_result_crash():
     """tests.oglconform.OGLCtest.interpret_result: status is crash if returncode is not 0"""
     test = oglconform.OGLCTest('group', 'test')
+    test.result.returncode = -1
     test.interpret_result()
 
     nt.eq_(test.result.result, 'crash')
-- 
2.7.0



More information about the Piglit mailing list