Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (57 sloc) 2.76 KB
author comments date layout slug title subtitle description categories tags
björn
true
2015-10-26 17:00:00 -0700
post
testing-against-many-versions-of-python-on-snap-ci
Using multiple versions of Python on Snap CI
Why just play with one snake?
How you can configure Snap CI to run your unit tests against all their supported Python verions. Don't worry, there's a clear $PATH to follow.
blog
programming
python
gocd-cli
snap-ci

Background

I'm running an open source project called gocd-cli which is, well, a command line interface for Go continuous delivery. The intention is to make it easier to handle common tasks around Go. But this post isn't really about that.

This project is supposed to be as portable as I can make it, becuse the original need I felt for it was born on RHEL6. Which is blessed with Python 2.6 by default. And we should definitely be looking to the future, meaning supporting Python 3, and I luckily got a pull request for just that. Since I couldn't find any free hosted Go around I went for the next best thing, Snap CI, which is also built by ThoughtWorks.

Easy to get going and works well, it's not Go, but it's definitely the easy starter drug for people that thinks Jenkins or Travis is good enough.

The solution

Snap supports all the versions of Python that I want by default, but they weren't all being made available at the same time. Python 2.6 and 2.7 were always there, but only one version of Python 3 at a time.

Luckily logging in to the snap-shell I found that all Python versions were available in /opt/local/python/<version>.

A quick change to the Snap config, to add these to my $PATH, and tox ran through without any problems.

New Snap CI config

What you'll need to add to your command box. Note it didn't work for me when I added it to the environment variable field, I'm guessing it's because the $PATH variable doesn't get interpolated correctly.

export PATH="$PATH:/opt/local/python/3.3.5/bin:/opt/local/python/3.4.0/bin:/opt/local/python/3.5.0/bin"

And look, my tests are passing!

Passing tests