[tox]
envlist = py{310}-sqla_{cext,nocext}-db_{sqlite,postgresql,mysql,oracle,mssql}

[testenv]
deps=pytest
     pytest-xdist
     mock
     db_postgresql: .[postgresql]
     db_mysql: .[mysql]
     db_mysql: .[pymysql]
     db_oracle: .[oracle]
     db_mssql: .[mssql]


allowlist_externals=sh

commands=
    db_{mysql}: {env:BASECOMMAND} {env:MYSQL:} {posargs}
    db_{postgresql}: {env:BASECOMMAND} {env:POSTGRESQL:} {posargs}
    db_{sqlite}: {env:BASECOMMAND} {env:SQLITE:} {posargs}
    db_{oracle}: {env:BASECOMMAND} {env:ORACLE:} {posargs}
    db_{mssql}: {env:BASECOMMAND} {env:MSSQL:} {posargs}

passenv=
    ORACLE_HOME 
    NLS_LANG 
    TOX_POSTGRESQL 
    TOX_MYSQL 
    TOX_ORACLE 
    TOX_MSSQL 
    TOX_SQLITE 
    TOX_WORKERS

# -E     : ignore PYTHON* environment variables (such as PYTHONPATH)
# -s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE
setenv=
    BASECOMMAND=python -m pytest test/aaa_profiling -x --nomemory --force-write-profiles
    PYTHONPATH=
    PYTHONNOUSERSITE=1
    sqla_nocext: DISABLE_SQLALCHEMY_CEXT=1
    sqla_cext: REQUIRE_SQLALCHEMY_CEXT=1
    db_sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
    db_postgresql: POSTGRESQL={env:TOX_POSTGRESQL:--db postgresql}
    db_mysql: MYSQL={env:TOX_MYSQL:--db mysql --db pymysql}
    db_oracle: ORACLE={env:TOX_ORACLE:--db oracle}
    db_mssql: MSSQL={env:TOX_MSSQL:--db mssql}


