Hudson and PythonSeptember 23rd, 2010 • 3 Comments
Regarding Continuous Integration (CI) systems I probably still like Hudson! Great tool and runs perfectly well. Just get the latest jar file and run it with java – jar hudson.jar. Now to get started you will need to install some plugins:
- the Python plugin
- the mercurial (or whatever SCM you use) plugin
- Violations Plugin (which will parse pylint output later on)
- Cobertura Plugin (which will parse the coverage output and display it nicely)
You can install those plugins in he management interface of hudson. When configuring the job in hudson you simple add a new “Build a free-style software project” job. Add SCM information – and than add some build steps. I had to use two:
python setup.py clean --all python setup.py build coverage erase nosetests --with-coverage --cover-package=<your packages> --with-xunit coverage xml
And a second one:
#!/bin/bash pylint -f parseable <your packages> > pylint.txt echo "pylint complete"
Both are external scripts. Now in the post-build section activate the JUnit test reporting and tell it to use the **/nosetests.xml file. Also activate the Cobertura Coverage report and tell it to use **/coverage.xml. Finally activate the Report Violations – and add pylint.txt in the right row.
Configure the rest of the stuff just as you like and hit the Build button. Thanks to XML the reporting tools written for java can parser the output generated for your Python project. Now you have nice reports from a Python project in Hudson!
A more detailed and great article about this topic can be found here.