-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding problem? #451
Comments
I'm getting the same here. I'm using Django1.3, Python 2.7.3, Win7x64 I managed to fix it by making a little workaround: def formatError(self, test, err):
"""Add captured output to error report.
"""
test.capturedOutput = output = self.buffer
self._buf = None
if not output:
# Don't return None as that will prevent other
# formatters from formatting and remove earlier formatters
# formats, instead return the err we got
return err
ec, ev, tb = err
return (ec, self.addCaptureToErr(ev, output), tb) We can write it like this: def formatError(self, test, err):
"""Add captured output to error report.
"""
try:
test.capturedOutput = output = self.buffer
except UnicodeDecodeError:
test.capturedOutput = output = 'FOOBAR'
self._buf = None
if not output:
# Don't return None as that will prevent other
# formatters from formatting and remove earlier formatters
# formats, instead return the err we got
return err
ec, ev, tb = err
return (ec, self.addCaptureToErr(ev, output), tb) Is it ok to do that? Traceback:Traceback (most recent call last): |
Patched in #988 |
What steps will reproduce the problem?
fetch https://bitbucket.org/dreamkxd/hgsubversion.svnmeta
install subvertpy on Windows, Python 2.7.1
https://bitbucket.org/dreamkxd/hgsubversion.svnmeta/downloads/subvertpy-0.8.8.win32-py2.7.exe
D:\CI\bld\hgsubversion.svnmeta\tests>nosetests --cover-html
............................................................................................................ETraceback (most recent call las
t):
File "D:\CI\Tools\Building\Python\Scripts\nosetests-script.py", line 9, in
load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\core.py", line 118, in init
*_extra_args)
File "D:\CI\Tools\Building\Python\lib\unittest\main.py", line 95, in init
self.runTests()
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\core.py", line 197, in runTests
result = self.testRunner.run(self.test)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\core.py", line 61, in run
test(result)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 176, in call
return self.run(_arg, *_kw)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 223, in run
test(orig)
File "D:\CI\Tools\Building\Python\lib\unittest\suite.py", line 65, in call
return self.run(_args, *_kwds)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 74, in run
test(result)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 176, in call
return self.run(_arg, *_kw)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 223, in run
test(orig)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 176, in call
return self.run(_arg, *_kw)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\suite.py", line 223, in run
test(orig)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\case.py", line 45, in call
return self.run(_arg, *_kwarg)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\case.py", line 138, in run
result.addError(self, err)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\proxy.py", line 131, in addError
formatted = plugins.formatError(self.test, err)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\plugins\manager.py", line 94, in call
return self.call(_arg, *_kw)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\plugins\manager.py", line 136, in chain
result = meth(_arg, **kw)
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\plugins\capture.py", line 73, in formatError
test.capturedOutput = output = self.buffer
File "D:\CI\Tools\Building\Python\lib\site-packages\nose\plugins\capture.py", line 125, in _get_buffer
return self._buf.getvalue()
File "D:\CI\Tools\Building\Python\lib\StringIO.py", line 270, in getvalue
self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
D:\CI\bld\hgsubversion.svnmeta\tests>nosetests
..
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Google Code Info:
Issue #: 457
Author: [email protected]
Created On: 2011-10-16T17:03:52.000Z
Closed On:
The text was updated successfully, but these errors were encountered: