summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Douchant <Fabrice.Douchant@logilab.fr>2008-10-17 15:52:13 +0200
committerFabrice Douchant <Fabrice.Douchant@logilab.fr>2008-10-17 15:52:13 +0200
commitc07e2ab2804ae24c52f790e1e4c26a37b324cc29 (patch)
tree40545eaa55a0de0e36cd87e677c191f603039e13
parent07818f75e913b3f26aa719f6ef1b8b501d4b4c84 (diff)
downloadlogilab-common-c07e2ab2804ae24c52f790e1e4c26a37b324cc29.tar.gz
bugfix when trying to print into consol not supported UTF-8 caracters (seems wired so)
-rw-r--r--test/unittest_decorators.py5
-rw-r--r--testlib.py3
2 files changed, 6 insertions, 2 deletions
diff --git a/test/unittest_decorators.py b/test/unittest_decorators.py
index 855f242..ba2dc36 100644
--- a/test/unittest_decorators.py
+++ b/test/unittest_decorators.py
@@ -6,6 +6,7 @@ class DecoratorsTC(TestCase):
def test_require_version_good(self):
""" should return the same function
"""
+ #raise Exception('t1')
def func() :
pass
sys.version_info = (2, 5, 5, 'final', 4)
@@ -20,6 +21,7 @@ class DecoratorsTC(TestCase):
def test_require_version_bad(self):
""" should return a different function : skipping test
"""
+ #raise Exception('t2')
def func() :
pass
sys.version_info = (2, 5, 5, 'final', 4)
@@ -34,6 +36,7 @@ class DecoratorsTC(TestCase):
def test_require_version_exception(self):
""" should throw a ValueError exception
"""
+ raise Exception('t3')
def func() :
pass
compare = ('2.5.a', '2.a', 'azerty')
@@ -44,6 +47,7 @@ class DecoratorsTC(TestCase):
def test_require_module_good(self):
""" should return the same function
"""
+ #raise Exception('t4')
def func() :
pass
module = 'sys'
@@ -54,6 +58,7 @@ class DecoratorsTC(TestCase):
def test_require_module_bad(self):
""" should return a different function : skipping test
"""
+ raise Exception('t5')
def func() :
pass
modules = ('bla', 'blo', 'bli')
diff --git a/testlib.py b/testlib.py
index 8b95666..485e08d 100644
--- a/testlib.py
+++ b/testlib.py
@@ -409,7 +409,6 @@ class SkipAwareTestResult(unittest._TextTestResult):
def printErrorList(self, flavour, errors):
for (_, descr), (test, err) in zip(self.descrs_for(flavour), errors):
- #print 'HERRRRRE', type(self.stream)
if PYGMENTS_FOUND and isatty(self.stream):
err = highlight(err, lexers.PythonLexer(),
formatters.terminal.TerminalFormatter())
@@ -421,7 +420,7 @@ class SkipAwareTestResult(unittest._TextTestResult):
self.stream.writeln("%s: %s" % (flavour, descr))
self.stream.writeln(self.separator2)
- self.stream.writeln(str(err))
+ self.stream.writeln("%s" % err.encode(sys.stdout.encoding, 'replace'))
try:
output, errput = test.captured_output()
except AttributeError: