How to Test Your Python Code in OSX using Travis CI

1 min read
How to Test Your Python Code in OSX using Travis CI

Since OSX does not natively support Python, you can customize it using a Job Matrix, matrix or jobs. The following contains examples from Python 3.5 to 3.8, including PyPy3.

matrix:  # or you can replace `matrix` with `jobs`
  include:
    - name: "Python: 3.5"
      os: osx
      language: shell
      python: 3.5
      cache:
        - directories:
          - $HOME/Library/Caches/pip
    - name: "Python: 3.6"
      os: osx
      language: shell
      python: 3.6
      cache:
        - directories:
          - $HOME/Library/Caches/pip
    - name: "Python: 3.7"
      os: osx
      language: shell
      python: 3.7
      cache:
        - directories:
          - $HOME/Library/Caches/pip
    - name: "Python: 3.8"
      os: osx
      language: shell
      python: 3.8
      cache:
        - directories:
          - $HOME/Library/Caches/pip
    - name: "Python: pypy3"
      os: osx
      language: shell
      python: pypy3
      cache:
        - directories:
          - $HOME/Library/Caches/pip

Read more articles like this in the future by buying me a coffee!

Buy me a coffeeBuy me a coffee