Test python setup.py install using Travis-CI

For continuous integration, it's important to test

python setup.py install

along with the more commonly used in situ development mode

pip install -e .

Here's an example .travis.yml installing from extras_requires while using python setup.py install:

language: python
group: travis_latest
dist: xenial

  depth: 25
  quiet: true

- 3.7
- 3.6

  - os: linux
    name: Install integration
    python: 3.7
    - python setup.py install
    - pip install $(basename $TRAVIS_REPO_SLUG)[tests]
    - cd $HOME
    - python -m pytest $TRAVIS_BUILD_DIR/tests

install: pip install -e .[tests]

script: pytest -r a -v

The extra steps in the “install integration” are to ensure the install under site-packages is used instead of the local directory.

To be clear for those not yet familiar with Travis-CI build matrix, this .travis.yml will run 3 tests:

  • Python 3.6 development mode
  • Python 3.7 development mode
  • Python 3.7 integration via installed package

$(basename $TRAVIS_REPO_SLUG) assumes your repo name is the same as the Python package name. It uses Travis-CI default environment variables Set this manually to the Python package name if different than the repo name.