Failure of encoding detection on Python2 causes hard to debug termination
Issue #331
resolved
in the case that someone moves the default coding line down a few lines, on python2 ascii is detected instead of utf-8, therefore coverage fails flat when decoding
i was only able to find the problem by adding a comment in coverages html reporting at the end of the html_file method right before the html = html.decode(encoding)
line
Comments (4)
-
-
- changed status to invalid
-
- changed status to open
The author contacted me on IRC to say, "the problem was mostly that the error left no way to figure what file it broke on."
-
- changed status to resolved
This was fixed in 529fef3d32ab. Encoding errors now don't break the HTML report at all.
- Log in to comment
The encoding declaration must be on the first or second line of the file. This is according to PEP 263: http://legacy.python.org/dev/peps/pep-0263/
Can you provide a reproducible test case that demonstrates the problem? I'll reopen the ticket then.
Thanks.