django-boardinghouse / tox.ini

[tox]
envlist =
  clean,
  flake8,
  py{27,34,py}-django{17,18,19,110}-{base,example1,flake8},
  ; pypy3 is currently Python 3.2.5. Django 1.9 only supports 2.7, 3.4, 3.5.
  {py33}-django18{,-example1,-flake8},
  ; Django 1.7 does not support Python 3.5
  py35-django{18,19,110}{,-example1,-flake8},
  ; py{27,34,35}-example1,
  docs
skip_missing_interpreters = true

[tox:travis]
2.7 = py27
3.3 = py33
3.4 = py34
3.5 = py35, flake8, docs

[testenv]
install_command=pip install --pre {opts} {packages}
deps=
  coverage
  base: django-rainbowtests
  django17: Django>=1.7,<1.8
  django18: Django>=1.8,<1.9
  django19: Django>=1.9,<1.10
  django110: Django<1.11
  djangotrunk: https://github.com/django/django/archive/master.zip
  base: hypothesis
  py27,py33,py34,py35: psycopg2
  pypy,py27: mock
  pypy,pypy3: psycopg2cffi
  pytz
  sqlparse
  django17,django18: django-braces
  flake8: flake8
setenv=
  DB_NAME={envname}
commands=
  pypy,pypy3: /bin/sh -c "echo 'from psycopg2cffi import compat; compat.register()' > {envdir}/site-packages/psycopg2.py"
  base: coverage run --parallel-mode --branch --source=boardinghouse --omit="boardinghouse/contrib/invite/*" runtests.py
  example1: {[example1]commands}
  flake8: flake8 boardinghouse
whitelist_externals=
  example1: createdb
  example1: dropdb

[testenv:clean]
deps=
  coverage
commands=
  coverage erase

[testenv:docs]
changedir=docs
deps= -rdocs/requirements.txt
commands=
  make clean
  rm -rf source/code/*
  make apidocs
  make
  sphinx-build -b html -d build/doctrees source  build/html
whitelist_externals=
  /usr/bin/make
  /bin/rm

[example1:loaddata]
commands=
  python examples/boarding_school/manage.py migrate
  python examples/boarding_school/manage.py loaddata user
  python examples/boarding_school/manage.py loaddata schools
  python examples/boarding_school/manage.py loaddata --schema hamilton hamilton
  python examples/boarding_school/manage.py loaddata --schema naracoorte_hs naracoorte_hs

[example1]
commands=
  dropdb --if-exists {env:DB_NAME}
  createdb {env:DB_NAME}
  {[example1:loaddata]commands}
  ; There is a bug in django < 1.10 that prevents migrations back to zero: so we will just accept
  ; a failure on this line. Would be nice to be able to have conditional stuff here, but for some
  ; reason we can't do it in this situation: prefixing the line with `django110:` results in an error.
  -python examples/boarding_school/manage.py migrate boardinghouse zero
  {[example1:loaddata]commands}

[testenv:flake8]
basepython=python3.5
deps=
  flake8
commands=
  flake8 boardinghouse

[testenv:isort]
# I can't seem to get this to reliably pick up the correct settings.
deps=
  isort
commands=
  isort -rc -c boardinghouse

[testenv:pylint]
# We generally don't use this in automated tests, because it's too strict. Maybe after
# tweaking the config for it!
deps=
  pylint
  django
commands=
  pylint boardinghouse

[testenv:status]
deps=
  coverage==4.0.3
  python-coveralls
commands=
  coverage combine
  coverage report
  coveralls
  coverage report --fail-under=95
whitelist_externals=
  /bin/rm
passenv=
  COVERALLS_REPO_TOKEN

[testenv:dev-status]
deps=
  coverage
commands=
  coverage combine
  coverage report
  rm -rf htmlcov
  coverage html
whitelist_externals=
  /bin/rm

[testenv:mutants]
deps=
  mutpy
commands=
  mut.py --target boardinghouse --unit-test tests