summaryrefslogtreecommitdiff
path: root/functional_tests
diff options
context:
space:
mode:
authorjpellerin <devnull@localhost>2010-12-01 15:39:11 -0500
committerjpellerin <devnull@localhost>2010-12-01 15:39:11 -0500
commitd2f05ea8fe2c8cf898bbfc1f7dafbfa7534faee1 (patch)
treed3430bc29a5a0ab83e645442582a21baddfcf3cb /functional_tests
parent271c9a6473409a3d6d8fb2267e7215de3658179e (diff)
parent32614c09fe6be226adbbb44f440b573ccec40892 (diff)
downloadnose-d2f05ea8fe2c8cf898bbfc1f7dafbfa7534faee1.tar.gz
Pulled python 3 vs ascii fix
Diffstat (limited to 'functional_tests')
-rw-r--r--functional_tests/test_xunit.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/functional_tests/test_xunit.py b/functional_tests/test_xunit.py
index 00e16b1..a3bbaff 100644
--- a/functional_tests/test_xunit.py
+++ b/functional_tests/test_xunit.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import codecs
import os
+import sys
import unittest
from nose.plugins.xunit import Xunit
from nose.plugins.skip import Skip
@@ -25,15 +27,20 @@ class TestXUnitPlugin(PluginTester, unittest.TestCase):
assert "test_skip (test_xunit_as_suite.TestForXunit) ... SKIP: skipit" in self.output
assert "XML: %s" % xml_results_filename in self.output
- f = open(xml_results_filename,'r')
+ f = codecs.open(xml_results_filename,'r', encoding='utf8')
result = f.read()
f.close()
- print result
+ print result.encode('utf8', 'replace')
assert '<?xml version="1.0" encoding="UTF-8"?>' in result
assert '<testsuite name="nosetests" tests="6" errors="2" failures="1" skip="1">' in result
assert '<testcase classname="test_xunit_as_suite.TestForXunit" name="test_error" time="0">' in result
- assert '<error type="%s.Exception" message="日本">' % (Exception.__module__,) in result
+ # TODO(Kumar) think of better x-platform code here that
+ # does not confuse 2to3
+ if sys.version_info[0:2] >= (3,0):
+ assert ('<error type="%s.Exception" message="日本">' % (Exception.__module__,)) in result
+ else:
+ assert ('<error type="%s.Exception" message="日本">' % (Exception.__module__,)).decode('utf8') in result
assert '</testcase>' in result
assert '</testsuite>' in result