summaryrefslogtreecommitdiff
path: root/framework/exceptions.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-01-05 14:48:10 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2016-02-08 12:29:33 -0800
commitc9ae4f051e1d6d53d5a55b9b390ed668962c9aee (patch)
tree2566a0106df4af1b8f1b0aad4dec69ce19a86021 /framework/exceptions.py
parent86b933a4f8c58a60ee9c542d1db39550a643a016 (diff)
python: use six unicode/bytes/str handling
This is not feature complete for python 3.x in and of itself, but it gets started by using six functions rather than str and unicode. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'framework/exceptions.py')
-rw-r--r--framework/exceptions.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/framework/exceptions.py b/framework/exceptions.py
index e0b04d6b7..566372fc8 100644
--- a/framework/exceptions.py
+++ b/framework/exceptions.py
@@ -24,6 +24,8 @@ from __future__ import print_function, absolute_import, division
import sys
import functools
+import six
+
__all__ = [
'PiglitInternalError',
'PiglitFatalError',
@@ -52,6 +54,7 @@ def handler(func):
return _inner
+@six.python_2_unicode_compatible
class PiglitException(Exception):
"""Class for non-error exceptions.
@@ -60,10 +63,11 @@ class PiglitException(Exception):
"""
def __str__(self):
- return ('An internal exception that should have been handled was not:'
+ return (u'An internal exception that should have been handled was not:'
'\n{}'.format(super(PiglitException, self).__str__()))
+@six.python_2_unicode_compatible
class PiglitInternalError(Exception):
"""Class for errors in piglit.
@@ -71,7 +75,7 @@ class PiglitInternalError(Exception):
"""
def __str__(self):
- return 'An internal error occured:\n{}'.format(
+ return u'An internal error occured:\n{}'.format(
super(PiglitInternalError, self).__str__())