From 0a9845d87d5960c53d23189af349d7bf4fc341b8 Mon Sep 17 00:00:00 2001 From: Jon Banafato Date: Tue, 24 Oct 2017 01:22:54 -0400 Subject: [PATCH] Run Travis-CI tests inside of tox By using tox instead of the default Travis-CI Python environments, we ensure that we have a single entrypoint to testing both locally and in CI. This reduces redundant code and makes it clear when test environments don't match up on different platforms. [tox-travis](https://tox-travis.readthedocs.io/en/stable/) is introduced here to automatically run tox jobs under the proper Travis-CI environments. Additionally, the coveralls step is moved to a [build stage](https://docs.travis-ci.com/user/build-stages) to run once after all other Travis-CI tests complete. --- .travis.yml | 20 ++++++++++++-------- tox.ini | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a7194b..98ac6f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,13 +9,17 @@ python: - "2.7" - "pypy" -# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors +# Use tox to run tests on Travis-CI to keep one unified method of running tests in any environment install: - - "pip install -r requirements.txt" - - "pip install coverage" - - "pip install coveralls" + - pip install coverage coveralls tox-travis -# command to run tests, e.g. python setup.py test -script: coverage run --source=pipreqs setup.py test -after_success: - coveralls +# Command to run tests, e.g. python setup.py test +script: tox + +# Use a build stage instead of after_success to get a single coveralls report +jobs: + include: + - stage: Coveralls + script: + - coverage run --source=pipreqs setup.py test + - coveralls diff --git a/tox.ini b/tox.ini index 69eed48..8b6f824 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py34, py35, py36 +envlist = py27, py34, py35, py36, pypy [testenv] setenv =