[tox]
envlist =
    coverage-erase
    {py27,py34,py35}-django{18,19,110,111}-{sqlite,postgres,mysql}
    py36-django111-{sqlite,postgres,mysql}
    coverage-report
    flake8

[testenv]
usedevelop = True
deps =
    django18: Django>=1.8,<1.9
    django19: Django>=1.9,<1.10
    django110: Django>=1.10,<1.11
    django111: Django>=1.11,<1.12
    coverage>=4.1
    postgres: psycopg2
    mysql: mysqlclient
commands =
    coverage-erase: coverage erase
    sqlite: coverage run -a tests/runtests.py
    postgres: coverage run -a tests/runtests.py -d psql
    mysql: coverage run -a tests/runtests.py -d mysql
    coverage-report: coverage report

[travis]
python =
    2.7: py27
    3.4: py34
    3.5: py35, flake8
    3.6: py36

[flake8]
max-line-length=120
exclude=build,venv,migrations,south_migrations,.tox

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

[tox]
envlist =
    begin
    {py27,py34,py35}-django{18,19,110,111}-{sqlite,postgres,mysql}
    py36-django111-{sqlite,postgres,mysql}
    end
    flake8

[testenv]
usedevelop = True
deps =
    django18: Django>=1.8,<1.9
    django19: Django>=1.9,<1.10
    django110: Django>=1.10,<1.11
    django111: Django>=1.11,<1.12
    coverage>=4.1
    postgres: psycopg2
    mysql: mysqlclient
commands =
    begin: coverage erase
    sqlite: coverage run -a tests/runtests.py
    postgres: coverage run -a tests/runtests.py -d psql
    mysql: coverage run -a tests/runtests.py -d mysql
    end: coverage report

[travis]
python =
    2.7: begin, py27, end
    3.4: begin, py34, end
    3.5: begin, py35, end, flake8
    3.6: begin, py36, end

[flake8]
max-line-length=120
exclude=build,venv,migrations,south_migrations,.tox

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

Make sure coverage reports are done for each run on travis
Make sure coverage reports are done for each run on travis

Also, rename coverage-erase and coverage-report to begin and end to make
tox.ini easier to read.
