erikrose/nose-progressive — Issue #33: UnicodeDecodeError when using logging, different case of #29
Author: lelit
Created: 2012-03-02 15:10:17+00:00
State: open

Consider the following script:

```python
# -*- coding: utf-8 -*-

import logging

logging.basicConfig()

def test_unicode_output():
logger = logging.getLogger('root')

logger.warning(u"Foo·····")
print u"This is something “weird”"
assert False, u"This too …"
```

Without progressive, I get:

```
F
======================================================================
FAIL: test.test_unicode_output
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/tp/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/tmp/tp/wip/test.py", line 12, in test_unicode_output
assert False, u"This too …"
AssertionError: This too …
-------------------- >> begin captured stdout << ---------------------
This is something “weird”

--------------------- >> end captured stdout << ----------------------
-------------------- >> begin captured logging << --------------------
root: WARNING: Foo·····
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (failures=1)
```

while --with-progressive emits a bad looking tb:

```

FAIL: test:test_unicode_output

ERROR: test:test_unicode_output
Traceback (most recent call last):
File "/tmp/tp/bin/nosetests", line 9, in
test:test_unicode_output load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
File "/tmp/tp/local/lib/python2.7/site-packages/nose/core.py", line 118, in __init__
test:test_unicode_output **extra_args)
File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
test:test_unicode_output self.runTests()
File "/tmp/tp/local/lib/python2.7/site-packages/nose/core.py", line 197, in runTests
test:test_unicode_output result = self.testRunner.run(self.test)
File "/tmp/tp/nose-progressive/noseprogressive/runner.py", line 42, in run
test:test_unicode_output test(result)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/suite.py", line 176, in __call__
test:test_unicode_output return self.run(*arg, **kw)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/suite.py", line 223, in run
test:test_unicode_output test(orig)
File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
test:test_unicode_output return self.run(*args, **kwds)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/suite.py", line 74, in run
test:test_unicode_output test(result)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/suite.py", line 176, in __call__
test:test_unicode_output return self.run(*arg, **kw)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/suite.py", line 223, in run
test:test_unicode_output test(orig)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/case.py", line 45, in __call__
test:test_unicode_output return self.run(*arg, **kwarg)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/case.py", line 138, in run
test:test_unicode_output result.addError(self, err)
File "/tmp/tp/local/lib/python2.7/site-packages/nose/proxy.py", line 135, in addError
test:test_unicode_output self.result.addError(self.test, self._prepareErr(err))
File "/tmp/tp/nose-progressive/noseprogressive/result.py", line 151, in addError
test:test_unicode_output self._printTraceback(test, err)
File "/tmp/tp/nose-progressive/noseprogressive/result.py", line 82, in _printTraceback
test:test_unicode_output self._options.editor)))
UnicodeDecodeErrortest:test_unicode_output : test:test_unicode_output 'ascii' codec can't decode byte 0xc2 in position 188: ordinal not in range(128)test:test_unicode_output
```

The logger output really makes the difference, commenting it out I get:

```
FAIL: test:test_unicode_output
vi +12 test.py # test_unicode_output
assert False, u"This too …"
AssertionError: This too \u2026
-------------------- >> begin captured stdout << ---------------------
This is something \u201cwierd\u201d

--------------------- >> end captured stdout << ----------------------

1 test, 1 failure, 0 errors in 0.0s
```