Continuous Integration for Python

The great article about Bitrise Pipelines and Tox for Python CI unfortunately does no longer exist. But I found this great article.

Basically you need a simple script like this, called bitbucket-pipelines.yml in your repo.

# This is a sample build configuration for Python.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: python:3.5.1

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - pip install -U tox
          - pip --version
          - tox --version
          # Actually run tox (build, setup and run tests, as specified in tox.ini)
          - tox

The rest of the setup is quite straight-forward if you are used to work with tox.

I’ve create a file called tox.ini that makes sure that the requirements are installed and the tests are run with nosetests:

[tox]
envlist = py35
skipsdist = true
 
[testenv]
deps = -r{toxinidir}/requirements.txt
commands = nosetests -w UnitTests/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s