Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@al45tair
Created August 2, 2017 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al45tair/34fdf558dd6c318a63c1ec9166b99c2e to your computer and use it in GitHub Desktop.
Save al45tair/34fdf558dd6c318a63c1ec9166b99c2e to your computer and use it in GitHub Desktop.
Testing against multiple or specific Python versions on macOS using Travis
# This Travis configuration lets you test different Python versions on macOS,
# which isn't something that's currently supported by Travis directly
language: python
# To install, we use pip to install pyenv; this, sadly, requires the --egg flag.
# Note that we can't use the --enable-framework argument for building Python
# because that breaks on Python 2.7.1 due to the lack of libSystemStubs.a (which
# that version assumes exists).
install:
- |
pip install -U pip
pip install --egg --no-binary pyenv pyenv
export PATH=~/.pyenv/bin:$PATH
eval "$(pyenv init -)"
pyenv install --skip-existing $PYTHON_VERSION
pyenv global $PYTHON_VERSION
pyenv shell $PYTHON_VERSION
pip install -U pip setuptools wheel py
pip install .
# In your matrix, use the PYTHON_VERSION environment variable to control the
# Python version against which you wish to run your tests
matrix:
include:
- os: osx
language: generic
env: PYTHON_VERSION=3.6.2
- os: osx
language: generic
env: PYTHON_VERSION=2.7.13
- os: osx
language: generic
env: PYTHON_VERSION=2.7.1
# You'll want to set your own script here
script: python setup.py test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment