我正在使用SonarQube 4.5。我运行nosetests来运行python单元测试并创建一个名为nosetests.xml的xunit xml文件。我通过Sonar Jenkins插件运行Sonar Runner。我设置了以下声纳属性:
sonar.projectKey=yauis
sonar.projectName=YAUIS
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=py
sonar.python.xunit.reportPath=nosetests.xml
sonar.python.pylint=/usr/bin/pylint
sonar.python.coverage.reportPath=coverage.xml
sonar.python.coveragePlugin=cobertura
我在SonarQube Runner日志中看到以下内容:
...
15:31:20.355 INFO - Sensor PythonXunitSensor...
15:31:20.363 INFO - Processing report '/var/lib/jenkins/jobs/yauis/workspace/nosetests.xml'
15:31:20.363 INFO - Parsing report '/var/lib/jenkins/jobs/yauis/workspace/nosetests.xml'
15:31:20.480 INFO - Sensor PythonXunitSensor done: 125 ms
...
以下是nosetests.xml的一个片段:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="nosetests" tests="30" errors="30" failures="0" skip="0">
<testcase classname="nose.failure.Failure" name="runTest" time="0.000">
<error type="exceptions.ImportError" message="cannot import name get_data_parameter
-------------------- >> begin captured logging << --------------------
py.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/rest_framework/fields.py:686: DeprecationWarning: The `blank` keyword argument is deprecated. Use the `required` keyword argument instead.
 super(DateTimeField, self).__init__(*args, **kwargs)

py.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/rest_framework/fields.py:465: DeprecationWarning: The `blank` keyword argument is deprecated. Use the `required` keyword argument instead.
 super(CharField, self).__init__(*args, **kwargs)

py.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/cassandra/cqltypes.py:63: UserWarning: The blist library is not available, so a normal set will be used in place of blist.sortedset for set collection values. You can find the blist library here: https://pypi.python.org/pypi/blist/
 "The blist library is not available, so a normal set will "

--------------------- >> end captured logging << ---------------------"><![CDATA[File "/usr/lib/python2.7/unittest/case.py", line 327, in run
testMethod()
File "/var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
addr.filename, addr.module)
File "/var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/var/lib/jenkins/jobs/yauis/workspace/src/adminapi/urls.py", line 8, in <module>
from views import AdminApiViewHandler
File "/var/lib/jenkins/jobs/yauis/workspace/src/adminapi/views.py", line 9, in <module>
from common.ViewUtils import json_response, get_data_parameter
File "/var/lib/jenkins/jobs/yauis/workspace/src/common/ViewUtils.py", line 13, in <module>
from common.utils import get_application_uri
File "/var/lib/jenkins/jobs/yauis/workspace/src/common/utils.py", line 550, in <module>
from common.managers.formfactormanager import FormfactorModifier
File "/var/lib/jenkins/jobs/yauis/workspace/src/common/managers/formfactormanager.py", line 3, in <module>
from common.ViewUtils import get_data_parameter
'cannot import name get_data_parameter\n-------------------- >> begin captured logging << --------------------\npy.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/rest_framework/fields.py:686: DeprecationWarning: The `blank` keyword argument is deprecated. Use the `required` keyword argument instead.\n super(DateTimeField, self).__init__(*args, **kwargs)\n\npy.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/rest_framework/fields.py:465: DeprecationWarning: The `blank` keyword argument is deprecated. Use the `required` keyword argument instead.\n super(CharField, self).__init__(*args, **kwargs)\n\npy.warnings: WARNING: /var/lib/jenkins/jobs/yauis/workspace/.pyenv/local/lib/python2.7/site-packages/cassandra/cqltypes.py:63: UserWarning: The blist library is not available, so a normal set will be used in place of blist.sortedset for set collection values. You can find the blist library here: https://pypi.python.org/pypi/blist/\n "The blist library is not available, so a normal set will "\n\n--------------------- >> end captured logging << ---------------------']]></error>
</testcase>
...
单位测试结果未在SonarQube中显示。我错过了什么?