How to get python unit test results in SonarQube? -
i'm using sonarqube 4.5. i've run nosetests run python unit tests , create xunit xml file called nosetests.xml. i'm running sonar runner via sonar jenkins plugin. i've set following sonar properties:
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
i'm seeing following in sonarqube runner log:
... 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 ...
here snippet 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: `blank` keyword argument deprecated. use `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: `blank` keyword argument deprecated. use `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: blist library not available, normal set used in place of blist.sortedset set collection values. can find blist library here: https://pypi.python.org/pypi/blist/
 "the blist library not available, normal set "

--------------------- >> 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> views import adminapiviewhandler file "/var/lib/jenkins/jobs/yauis/workspace/src/adminapi/views.py", line 9, in <module> common.viewutils import json_response, get_data_parameter file "/var/lib/jenkins/jobs/yauis/workspace/src/common/viewutils.py", line 13, in <module> common.utils import get_application_uri file "/var/lib/jenkins/jobs/yauis/workspace/src/common/utils.py", line 550, in <module> common.managers.formfactormanager import formfactormodifier file "/var/lib/jenkins/jobs/yauis/workspace/src/common/managers/formfactormanager.py", line 3, in <module> 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: `blank` keyword argument deprecated. use `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: `blank` keyword argument deprecated. use `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: blist library not available, normal set used in place of blist.sortedset set collection values. can find blist library here: https://pypi.python.org/pypi/blist/\n "the blist library not available, normal set "\n\n--------------------- >> end captured logging << ---------------------']]></error> </testcase> ...
the unit test results not showing in sonarqube. missing?
this known issues sonarqube 4.2+ has been fixed not released yet: sonarpy-37
you should stay tuned , wait version 1.4 of python plugin.
Comments
Post a Comment