You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If source file's path has any unicode characters in it, the dump into the xml will fail on Python 2.
#!bash
~/temp/$ coverage xml # No error.
~/temp/테스트/$ coverage xml # Error.
#!python
/usr/lib/python2.7/genericpath.py:71: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
s1 = min(m)
Traceback (most recent call last):
File "/usr/local/bin/coverage", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 756, in main
status = CoverageScript().command_line(argv)
File "/usr/local/lib/python2.7/dist-packages/coverage/cmdline.py", line 517, in command_line
total = self.coverage.xml_report(outfile=outfile, **report_args)
File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 1070, in xml_report
return reporter.report(morfs, outfile=outfile)
File "/usr/local/lib/python2.7/dist-packages/coverage/xmlreport.py", line 76, in report
self.report_files(self.xml_file, morfs)
File "/usr/local/lib/python2.7/dist-packages/coverage/report.py", line 91, in report_files
report_fn(fr, self.coverage._analyze(fr))
File "/usr/local/lib/python2.7/dist-packages/coverage/xmlreport.py", line 166, in xml_file
xclass.setAttribute("name", os.path.relpath(rel_name, dirname))
File "/usr/lib/python2.7/posixpath.py", line 441, in relpath
i = len(commonprefix([start_list, path_list]))
File "/usr/lib/python2.7/genericpath.py", line 71, in commonprefix
s1 = min(m)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 0: ordinal not in range(128)
Line 168 in coverage/xmlreport.py makes this exception. It seems to problem of unicode handling issue with Python 2.
Anyway I could fix this problem by casting dirname to unicode. This fix is a kind of quick hack, so I hope this suggestion helps to find the root cause of this problem.
Originally reported by Dongmin Kim (Bitbucket: kim135797531, GitHub: kim135797531)
If source file's path has any unicode characters in it, the dump into the xml will fail on Python 2.
Line 168 in
coverage/xmlreport.py
makes this exception. It seems to problem of unicode handling issue with Python 2.Anyway I could fix this problem by casting
dirname
to unicode. This fix is a kind of quick hack, so I hope this suggestion helps to find the root cause of this problem.The text was updated successfully, but these errors were encountered: