UPDATE 20140530: This article is DEPRECATED. I recommend using the pyenv plugin instead.
Jenkins CI's ShiningPanda plugin makes testing Python extremely easy. It even includes support for testing against multiple Python versions within the same Job. Unfortunately ShiningPanda, and Jenkins itself, do not automatically install these dependent Python versions.
Using Pythonbrew we can configure Jenkins to automatically download and install our dependent versions of Python.
Paste in the following Groovy script and click Run:
def download = """curl -skLO http://xrl.us/pythonbrewinstall"""
def download_proc = download.execute()
def install = """bash pythonbrewinstall"""
def install_proc = install.execute()
download_proc.waitFor()
println "return code: ${download_proc.exitValue()}"
println "stderr: ${download_proc.err.text}"
println "stdout: ${download_proc.in.text}"
install_proc.waitFor()
println "return code: ${install_proc.exitValue()}"
println "stderr: ${install_proc.err.text}"
println "stdout: ${install_proc.in.text}"
From the Jenkins console, browse to Manage Jenkins > Configure System.
For each Python version to install, enter a Name and click Install Automatically > Add Installer > Run Command.
Given a Python version of X.Y.Z, for Command enter: $HOME/.pythonbrew/bin/pythonbrew install X.Y.Z
$HOME/.pythonbrew/pythons/Python-X.Y.Z/
Under Configuration Matrix, click Add Axis > Python.
Select the Python version(s) to run this job against.
Under Build, Add build steps for your project.
I prefer using the Virtualenv Builder for my project, with the following Commands:
$PYTHON_EXE setup.py install
$PYTHON_EXE setup.py nosetests
Which leaves me with healthy, all natural, self-installed multiple Python version job configuration: