Skip to content

Commit

Permalink
Add flake8 checks and more python versions on Travis/Tox
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwilsdon committed Jun 13, 2016
1 parent 883a5b9 commit f6be949
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 20 deletions.
49 changes: 36 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "pypy"
sudo: false

env:
global:
# Undocumented feature of nose-show-skipped.
NOSE_SHOW_SKIPPED: 1

matrix:
include:
- python: 2.7
env: {TOXENV: py27-test}
- python: 3.3
env: {TOXENV: py33-cov, COVERAGE: 1}
- python: 3.4
env: {TOXENV: py34-test}
- python: 3.5
env: {TOXENV: py35-test}
- python: pypy
env: {TOXENV: pypy-test}
- python: 2.7
env: {TOXENV: py27-flake8}
- python: 3.3
env: {TOXENV: py33-flake8}
- python: 2.7
env: {TOXENV: docs}

# To install dependencies, tell tox to do everything but actually running the
# test.
install:
- pip install .
- travis_retry piip install tox
- travis_retry tox --notest

script: nosetests --with-coverage --cover-package=confuse
script: tox

# coveralls.io reporting, using https://github.com/coagulant/coveralls-python
# Only report coverage for one version.
before_script:
- "[[ $TRAVIS_PYTHON_VERSION == '3.3' ]] && pip install coveralls || true"
# Report coverage to codecov.io.
before_install:
- "[ ! -z $COVERAGE ] && travis_retry pip install codecov || true"
after_success:
- "[[ $TRAVIS_PYTHON_VERSION == '3.3' ]] && coveralls || true"
- "[ ! -z $COVERAGE ] && codecov || true"

sudo: false
cache:
pip: true
20 changes: 20 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[nosetests]
verbosity=1
logging-clear-handlers=1
eval-attr="!=slow"

[flake8]
min-version=2.7
# Default pyflakes errors we ignore:
# - E241: missing whitespace after ',' (used to align visually)
# - E221: multiple spaces before operator (used to align visually)
# - E731: do not assign a lambda expression, use a def
# - C901: function/method complexity
# `flake8-future-import` errors we ignore:
# - FI50: `__future__` import "division" present
# - FI51: `__future__` import "absolute_import" present
# - FI12: `__future__` import "with_statement" missing
# - FI53: `__future__` import "print_function" present
# - FI14: `__future__` import "unicode_literals" missing
# - FI15: `__future__` import "generator_stop" missing
ignore=C901,E241,E221,E731,FI50,FI51,FI12,FI53,FI14,FI15
43 changes: 36 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py27, py34, pypy
envlist = py27-test, py27-flake8, docs

[testenv]
commands =
nosetests
# The exhaustive list of environments is:
# envlist = py{27,33,34,35}-{test,cov}, py{27,33}-flake8, docs

[_test]
deps =
coverage
nose
nose-show-skipped
pyyaml


[testenv:py27]
[_flake8]
deps =
{[testenv]deps}
argparse
flake8
flake8-future-import
pep8-naming
files = example confuse.py test setup.py docs

[testenv]
passenv =
NOSE_SHOW_SKIPPED # Undocumented feature of nose-show-skipped.
deps =
{test,cov}: {[_test]deps}
py{27,33}-flake8: {[_flake8]deps}
commands =
cov: nosetests --with-coverage {posargs}
test: nosetests {posargs}
py27-flake8: flake8 --min-version 2.7 {posargs} {[_flake8]files}
py33-flake8: flake8 --min-version 3.3 {posargs} {[_flake8]files}

[testenv:docs]
basepython = python2.7
deps = sphinx
commands = sphinx-build -W -q -b html docs {envtmpdir}/html {posargs}

0 comments on commit f6be949

Please sign in to comment.