Pergunta

  1. Go to project src
  2. run py.test --pep8 --junitxml=pep8.log

First console shows .py files pytest already tested, than it brakes with a message:

INTERNALERROR>   File "C:\Python27\lib\site-packages\_pytest\junitxml.py", line 134, in append_failure
INTERNALERROR>     fail.append(str(report.longrepr))
INTERNALERROR> UnicodeEncodeError: 'ascii' codec can't encode characters in position 1430-1434: ordinal not in range(128)

I tried to fix this by transforming fail.append(str(report.longrepr)) to fail.append(str(report.longrepr.encode("utf-8"))) but pytest continues failing on the other lines of this file and _xmlgen.py file.

I think there is a better way to fix this globally then editing every line of code it fails on.

Foi útil?

Solução

I filed an issue for pytest developer and it was fixed https://bitbucket.org/hpk42/pytest/issue/368/unicode-error-when-launching-pytest

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top