From bee80c4c49c689f2650b8b82e3b64c1c6a302a4b Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Wed, 2 Apr 2014 22:48:53 +0200 Subject: [PATCH] Use tox to test on travis and add docs and flake8 Travis CI now also confirm that the docs build correctly and the flake8 runs succesfully. Tox also has the advantage that it tests that beets installs correctly. Currently flake8 does not run succesfully so it is configured to not fail the build on Travis. --- .travis.yml | 28 ++++++++++++++++------------ setup.cfg | 5 +++++ tox.ini | 18 +++++++++++++++--- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6eda6e736..7f6dca782 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,33 @@ language: python -python: - - "2.7" - - "2.6" - - "pypy" +python: 2.7 branches: only: - master +env: + - TOX_ENV=py26 + - TOX_ENV=py27 + - TOX_ENV=pypy + - TOX_ENV=docs + - TOX_ENV=flake8 + +matrix: + allow_failures: + - env: TOX_ENV=flake8 + install: - - travis_retry pip install . - - travis_retry pip install pylast flask responses - # unittest backport on Python < 2.7 - - "[[ $TRAVIS_PYTHON_VERSION == '2.6' ]] && pip install unittest2 || true" - travis_retry sudo apt-get update - travis_retry sudo apt-get install -qq bash-completion + - travis_retry pip install tox + - "[[ $TOX_ENV == 'py27' ]] && pip install coveralls || true" -script: nosetests --with-coverage --cover-package=beets +script: tox -e $TOX_ENV # coveralls.io reporting, using https://github.com/coagulant/coveralls-python # Only report coverage for one version. -before_script: - - "[[ $TRAVIS_PYTHON_VERSION == '2.7' ]] && pip install coveralls || true" after_success: - - "[[ $TRAVIS_PYTHON_VERSION == '2.7' ]] && coveralls || true" + - "[[ $TOX_ENV == 'py27' ]] && coveralls || true" notifications: irc: diff --git a/setup.cfg b/setup.cfg index acd86dbcf..8feeb8301 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,8 @@ [nosetests] verbosity=1 logging-clear-handlers=1 + +[flake8] +# F401 module imported but unused +# E231 missing whitespace after ',' (used to align visually) +ignore=F401,E241 diff --git a/tox.ini b/tox.ini index ff9166464..c1e4b706e 100644 --- a/tox.ini +++ b/tox.ini @@ -4,17 +4,29 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27, pypy +envlist = py27,docs,flake8 [testenv] -commands = - nosetests deps = nose pylast flask + coverage + responses +commands = + nosetests --with-coverage [testenv:py26] deps = {[testenv]deps} unittest2 + +[testenv:docs] +changedir = docs +deps = sphinx +commands = + sphinx-build -W -b html . {envtmpdir}/html + +[testenv:flake8] +deps = flake8 +commands = flake8 beets beetsplug beet test setup.py docs