Coverage report generation crashes with UnicodeDecodeError
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Low
|
Renier Morales |
Bug Description
System: Ubuntu 11.10, x86. Python 2.7.2+. Nova commit: f8aa96679552935
Running "./run_tests.sh -c" crashes on the coverage report generation step with:
Running PEP8 and HACKING compliance check...
ERROR: import 'import memcache' failed: No module named memcache
ERROR: import 'import memcache' failed: No module named memcache
ERROR: import 'import rabbit' failed: No module named rabbit
ERROR: import 'import win32console as win' failed: No module named win32console
ERROR: import 'import win32console' failed: No module named win32console
ERROR: import 'import pywintypes' failed: No module named pywintypes
ERROR: import 'import qpid' failed: No module named qpid
ERROR: import 'from nova.rpc import impl_qpid' failed: No module named qpid.messaging
ERROR: import 'import qpid.messaging' failed: No module named qpid.messaging
ERROR: import 'import qpid.messaging.
ERROR: import 'import memcache' failed: No module named memcache
ERROR: import 'import memcache' failed: No module named memcache
ERROR: import 'import ldap' failed: No module named ldap
ERROR: import 'import bpython' failed: No module named bpython
ERROR: import 'import IPython' failed: No module named IPython
ERROR: import 'import XenAPI' failed: No module named XenAPI
ERROR: import 'import win32com.client' failed: No module named win32com.client
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import pluginlib_nova as pluginlib' failed: No module named XenAPI
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import xenstore' failed: No module named XenAPIPlugin
ERROR: import 'import XenAPI' failed: No module named XenAPI
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import XenAPI' failed: No module named XenAPI
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import pluginlib_nova as pluginlib' failed: No module named XenAPI
tools/hacking.
__import__(mod, globals(), locals(), [], -1)
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
Generating coverage report in covhtml/
Traceback (most recent call last):
File "/opt/stack/
load_
File "/opt/stack/
status = CoverageScript(
File "/opt/stack/
directory=
File "/opt/stack/
reporter.
File "/opt/stack/
self.
File "/opt/stack/
report_fn(cu, self.coverage.
File "/opt/stack/
self.
File "/opt/stack/
write_
File "/opt/stack/
f.write(
File "/opt/stack/
return codecs.
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 28308: invalid continuation byte
Changed in nova: | |
assignee: | nobody → Renier Morales (renier-h) |
Changed in nova: | |
milestone: | none → folsom-1 |
importance: | Undecided → Low |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | folsom-1 → 2012.2 |
Even though we are passing --cover-package to nose (in run_tests.sh), it collects data on everything (seems this option is only to filter report output, not data collection). Problem is that when we use the coverage script directly to generate the report, we don't pass any report filtering option to it, so it goes and tries to generate report on all the data collected.
It happens that feedparser, used by nova/tests/ api/openstack/ compute/ test_versions. py uses drv_libxml2 (python xml parser-- if installed on the system) and this file has a bad utf-8 character in it. So when coverage is generating the html report for this file, it crashes trying to decode parts of the file into utf8.
This problem is actually fixed upstream in the coverage tool, but this has not been put in an official release yet (see https:/ /bitbucket. org/ned/ coveragepy/ issue/157/ chokes- on-source- files-with- non-utf- 8).
Solution seems to be to add filtering to the direct coverage tool call in run_tests.sh. After I did this in my working dir, things ran fine generating the right nova coverage reports. Putting a patch together on this.