New issue 578: UnicodeDecodeError masks SyntaxError on discovery https://bitbucket.org/hpk42/pytest/issue/578/unicodedecodeerror-masks-syntaxerror-on
Anthony Sottile: Here's a minimal reproduction, my case was obviously more complicated and harder to figure out :). ``` $ python --version Python 2.6.9 $ py.test --version This is pytest version 2.6.1, imported from /home/asottile/workspace/pre-commit/.tox/py26/lib/python2.6/site-packages/pytest.pyc $ cat test.py # -*- coding: UTF-8 -*- ☃ $ py.test !$ py.test test.py ============================= test session starts ============================== platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1 collected 0 items / 1 errors ==================================== ERRORS ==================================== ___________________________ ERROR collecting test.py ___________________________ .tox/py26/lib/python2.6/site-packages/py/_code/code.py:412: in getrepr return fmt.repr_excinfo(self) .tox/py26/lib/python2.6/site-packages/py/_code/code.py:589: in repr_excinfo reprtraceback = self.repr_traceback(excinfo) .tox/py26/lib/python2.6/site-packages/py/_code/code.py:581: in repr_traceback reprentry = self.repr_traceback_entry(entry, einfo) .tox/py26/lib/python2.6/site-packages/py/_code/code.py:543: in repr_traceback_entry s = self.get_source(source, line_index, excinfo, short=short) .tox/py26/lib/python2.6/site-packages/py/_code/code.py:489: in get_source lines.extend(self.get_exconly(excinfo, indent=indent, markall=True)) .tox/py26/lib/python2.6/site-packages/py/_code/code.py:496: in get_exconly exlines = excinfo.exconly(tryshort=True).split('\n') .tox/py26/lib/python2.6/site-packages/py/_code/code.py:376: in exconly text = ''.join(lines) E UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128) =========================== 1 error in 0.04 seconds ============================ $ python !$ python test.py File "test.py", line 3 ☃ ^ SyntaxError: invalid syntax ``` _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit