From bee80c4c49c689f2650b8b82e3b64c1c6a302a4b Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Wed, 2 Apr 2014 22:48:53 +0200 Subject: [PATCH 1/6] 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 From fdd2849feca1872d19b08f041b4538de76014e03 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Wed, 2 Apr 2014 22:56:24 +0200 Subject: [PATCH 2/6] Ignore generated man pages --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 692a4ecf3..74f6912b7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ dist/* beets.egg-info/* build/* docs/_build/* +man From 2ff7735f89b97f3499e4b4a0e4f10a97622a15cf Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Wed, 2 Apr 2014 23:49:35 +0200 Subject: [PATCH 3/6] Sphinx is required to build the package --- tox.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index c1e4b706e..2c603469c 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ deps = flask coverage responses + sphinx commands = nosetests --with-coverage @@ -23,10 +24,11 @@ deps = [testenv:docs] changedir = docs -deps = sphinx commands = sphinx-build -W -b html . {envtmpdir}/html [testenv:flake8] -deps = flake8 +deps = + {[testenv]deps} + flake8 commands = flake8 beets beetsplug beet test setup.py docs From 7927146f12ad0250c7b851ded21795bf69db12ae Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Thu, 3 Apr 2014 00:58:57 +0200 Subject: [PATCH 4/6] We need sphinx before installing the tox environment --- .travis.yml | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f6dca782..fbef76f77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: install: - travis_retry sudo apt-get update - travis_retry sudo apt-get install -qq bash-completion - - travis_retry pip install tox + - travis_retry pip install tox sphinx - "[[ $TOX_ENV == 'py27' ]] && pip install coveralls || true" script: tox -e $TOX_ENV diff --git a/tox.ini b/tox.ini index 2c603469c..f6ace8dd5 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,6 @@ deps = flask coverage responses - sphinx commands = nosetests --with-coverage From 8488f665fc39927b42b38cf7cd084270a03a5887 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Thu, 3 Apr 2014 01:41:18 +0200 Subject: [PATCH 5/6] Add sphinx dependency to tox virtual environment --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index f6ace8dd5..9dcbbf76c 100644 --- a/tox.ini +++ b/tox.ini @@ -23,6 +23,8 @@ deps = [testenv:docs] changedir = docs +deps = + sphinx commands = sphinx-build -W -b html . {envtmpdir}/html From 9fab6e7ca36c8b14adfa9a65c1b6a8b7db03315a Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Thu, 3 Apr 2014 01:52:21 +0200 Subject: [PATCH 6/6] Use coverage only with py27 --- tox.ini | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 9dcbbf76c..32b291be6 100644 --- a/tox.ini +++ b/tox.ini @@ -11,16 +11,22 @@ deps = nose pylast flask - coverage responses commands = - nosetests --with-coverage + nosetests [testenv:py26] deps = {[testenv]deps} unittest2 +[testenv:py27] +deps = + {[testenv]deps} + coverage +commands = + nosetests + [testenv:docs] changedir = docs deps =