New issue 573: --boxed raises UnicodeEncodeError when used with --capture=no
https://bitbucket.org/hpk42/pytest/issue/573/boxed-raises-unicodeencodeerror-when-used
David Röthlisberger:
With the following test case in "test.py":
```python
# coding: utf-8
def test_unicode():
print u"ünicöde"
```
Running the above test case with `py.test --boxed --capture=no test.py` fails
with:
```
==================================== test session starts
=====================================
platform darwin -- Python 2.7.8 -- py-1.4.23 -- pytest-2.6.1
plugins: xdist
collected 1 items
test.py F
========================================== FAILURES
==========================================
________________________________________ test_unicode
________________________________________
def test_unicode():
> print u"ünicöde"
test.py:4:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <open file
'/var/folders/v5/zd0hjrsj7mz43nwfqrfdpz640000gn/T/tmpOym3Ww/stdout', mode 'w'
at 0x10a02ab70>
data = 'ünicöde'
def write(self, data):
> f.write(data)
E UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in
position 0: ordinal not in range(128)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py/_process/forkedfunc.py:20:
UnicodeEncodeError
```
Note that any other combination of --boxed and --capture works ok:
```
✓ py.test -v --capture=fd test.py
✓ py.test -v --capture=fd --boxed test.py
✓ py.test -v --capture=sys test.py
✓ py.test -v --capture=sys --boxed test.py
✓ py.test -v --capture=no test.py
x py.test -v --capture=no --boxed test.py
```
Using `-p no:capture` has the same effect as `--capture=no` above.
Is using `--boxed` with `--capture=no` a valid combination? (I need to
implement my own capturing –which is working except for this issue– and that is
why I need to disable pytest's capture plugin).
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit