Search code examples
pythonjenkinsnosexunit

python nose xunit report file is empty


I have a problem running nose tests and get results inside Jenkins.

The job has a shell script like this:

. /var/lib/jenkins/envs/itravel/bin/activate
python api/manage.py syncdb --noinput
DJANGO_SETTINGS_MODULE=ci_settings nosetests --verbosity=0 --processes=1 --with-xunit --xunit-file=nosetests.xml
deactivate

Part of the test suite is run using the django_nose.NoseTestSuiteRunner.

All the tests are run and the resulting nosetests.xml file is created but does not seem to be filled with the tests results:

<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="0" errors="0" failures="0" skip="0"></testsuite>

I noticed that on an import Error fail the file is filled with one error, but otherwise, nothing...

Any idea? Is there something special to do from the tests side? Any property to set or so?

Thanks.


Solution

  • As far as I know, the --processes option is not compatible with --with-xunit. When you ask nosetests to run with the processes plugin, the tests are run in specified number of subprocesses. The xunit plugin does not know how to gather results into the xml file.

    Just remove the --processes option and you should be fine.