Simple python job on Jenkins

In this tutorial i show, how you as a tester can create a very basic python code analysis and documentation job in your build server.


Install needed python modules

$ pip install pylint
$ pip install pep8
$ pip install epydoc

Install needed Jenkins plugins

  • HTML Publisher Plugin
  • Violations

Create a Free Style job

Create a new job with your requirements (e.g. Project name, Source-Code Management, etc.). Now insert commands “Build > Execute Shell”.

pep8 ${WORKSPACE}/<module|file> > pep8_report.txt

echo "pep8 complete"

pylint -f parseable ${WORKSPACE}/<module|file> | tee pylint_report.txt

echo "pylint complete"

[ -d ${WORKSPACE}/API ] && rm -fr ${WORKSPACE}/API

epydoc ${WORKSPACE}/<module|file> --html --name 'My Project API' -o ${WORKSPACE}/API/

echo "epydoc complete"

Add the Post-Build-Action – Report Violations and Publish HTML reports. On violations insert the pep8 (pep8_report.txt) and pylint (pylint_report.txt) values. On Publish HTML reports add the folder API.

After running the build, the screen should look like this:

Jenkins Python Report

MacPorts Basics

Update Ports

$ sudo port selfupdate

Search Ports

Search for specific ports

$ port search python

Simple search for ports by line

$ port search --line python

Advanced search for ports (start with python)

$ port search --name --line --glob 'python*'

Install ports

$ sudo port install python34

Clean ports (if install fails)

$ port clean <portname>

Uninstall ports

$ sudo port uninstall <portname>

List installed ports

$ port installed

Update ports

Check for updates

$ port outdated

Update outdated ports

$ sudo port upgrade outdated

Update specific port

$ sudo port upgrade <portname>