Travis CI Linux, MacOS and Windows Python tests

MacOS osx Travis-CI image has Python 3 installed by default. In this strategy, test across multiple Python versions on Linux, and one Python 3 version on osx and windows.

Template

A typical .travis.yml for MacOS, Linux and Windows for a Python build looks like:

language: python
group: travis_latest
dist: xenial

git:
  depth: 3
  quiet: true

python:
- 3.7
- 3.6
- 3.5

matrix:
  include:
  - os: linux
    python: 3.7
    install: pip install -e .[tests,cov]
    script: 
    - flake8
    - mypy . --ignore-missing-imports
    after_success:
    - pytest --cov --cov-config=setup.cfg
    - coveralls
  - os: osx
    language: sh
    install: pip3 install -e .[tests]
  - os: windows
    language: sh
    before_install:
    - choco install python3
    - export PATH="/c/Python37:/c/Python37/Scripts:$PATH"

install: pip install -e .[tests]

script: pytest -rsv

Notes

Tags: , ,

Categories:

Written by Michael Hirsch, Ph.D. //

Comments