[tox]

# current mysqlclient fails with <=SQLA 0.9 on py3k due to 
# old unicode statements flag
envlist = py{27,33,34,35,36}-sqla{10,11}, py{27}-sqla{079,084,09}

SQLA_REPO = {env:SQLA_REPO:git+http://git.sqlalchemy.org/sqlalchemy.git}

[testenv]
cov_args=--cov=alembic --cov-report term --cov-report xml

deps=pytest<=3.0.7
     pytest-xdist<=1.16.0
     mock
     sqla079: {[tox]SQLA_REPO}@rel_0_7_9
     sqla084: {[tox]SQLA_REPO}@rel_0_8_4
     sqla09: {[tox]SQLA_REPO}@rel_0_9
     sqla10: {[tox]SQLA_REPO}@rel_1_0
     sqla11: {[tox]SQLA_REPO}@rel_1_1
     postgresql: psycopg2
     mysql: mysqlclient
     oracle: cx_oracle
     mssql: pymssql
     cov: pytest-cov


sitepackages=True
usedevelop=True

# only use --dropfirst option if we're *not* using -n;
# if -n is used, we're working in brand new DBs anyway
setenv=
    BASECOMMAND=python -m pytest
    WORKERS=-n4
    sqla079: WORKERS=--dropfirst
    oracle: WORKERS=-n2
    cov: COVERAGE={[testenv]cov_args}
    sqlite: SQLITE=--db sqlite
    postgresql: POSTGRESQL=--db postgresql
    mysql: MYSQL=--db mysql
    oracle: ORACLE=--db oracle --low-connections --write-idents oracle_idents.txt
    mssql: MSSQL=--db pymssql

# tox as of 2.0 blocks all environment variables from the
# outside, unless they are here (or in TOX_TESTENV_PASSENV,
# wildcards OK).  Need at least these
passenv=ORACLE_HOME NLS_LANG

commands=
  {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:COVERAGE:} {posargs}
  {oracle}: python reap_oracle_dbs.py oracle_idents.txt


[testenv:pep8]
deps=flake8
commands = python -m flake8 {posargs}


[flake8]

show-source = True
ignore = E711,E712,E721,D,N
# F841,F811,F401
exclude=.venv,.git,.tox,dist,doc,*egg,build


