[tox]
minversion = 2.0
envlist = py27,py3{4,5,6,7,8,9}-sqlite{,-memory},py{27,39}-flake8

# Base test environment settings
[testenv]
# Ensure we cd into sqlobject before running the tests
changedir = ./sqlobject/
basepython =
    py27: {env:TOXPYTHON:python2.7}
    py34: {env:TOXPYTHON:python3.4}
    py35: {env:TOXPYTHON:python3.5}
    py36: {env:TOXPYTHON:python3.6}
    py37: {env:TOXPYTHON:python3.7}
    py38: {env:TOXPYTHON:python3.8}
    py39: {env:TOXPYTHON:python3.9}
commands =
    {envpython} --version
    {envpython} -c "import struct; print(struct.calcsize('P') * 8)"
deps =
    -rdevscripts/requirements/requirements_tests.txt
    mysqldb: mysql-python
    mysqlclient: mysqlclient
    mysql-connector: mysql-connector <= 2.2.2
    mysql-oursql: git+https://github.com/sqlobject/oursql.git@master#egg=oursql
    mysql-oursql3: git+https://github.com/sqlobject/oursql.git@py3k#egg=oursql
    pymysql: pymysql
    mariadb: mariadb
    postgres-psycopg: psycopg2-binary
    pygresql: -rdevscripts/requirements/requirements_pygresql.txt
    pypostgresql: git+https://github.com/sqlobject/py-postgresql.git@fix_w32#egg=pypostgresql
    postgres-pg8000: git+https://github.com/sqlobject/pg8000.git@getuser#egg=pg8000
    pyodbc: pyodbc
    pypyodbc: pypyodbc
    supersqlite: supersqlite
    firebird-fdb: fdb
    firebirdsql: firebirdsql
passenv = CI TRAVIS TRAVIS_* APPVEYOR DISTUTILS_USE_SDK MSSdk INCLUDE LIB PGPASSWORD WINDIR
# Don't fail or warn on uninstalled commands
platform = linux
whitelist_externals =
    cmd
    mysql
    createdb
    dropdb
    rm
    sudo
    isql-fb
    sqlcmd

# MySQL test environments
[mysqldb]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=mysqldb&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysqldb]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysqldb]commands}

[testenv:py34-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[testenv:py35-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[testenv:py36-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[testenv:py37-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[testenv:py38-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[testenv:py39-mysqldb]
commands = {envpython} -c "print('MySQL-python requires Python 2.7')"
deps =

[mysqlclient]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=mysqldb&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysqlclient]
commands = {envpython} -c "print('mysqlclient requires Python 3.4+')"
deps =

[testenv:py34-mysqlclient]
commands = {[mysqlclient]commands}

[testenv:py35-mysqlclient]
commands = {[mysqlclient]commands}

[testenv:py36-mysqlclient]
commands = {[mysqlclient]commands}

[testenv:py37-mysqlclient]
commands = {[mysqlclient]commands}

[testenv:py38-mysqlclient]
commands = {[mysqlclient]commands}

[testenv:py39-mysqlclient]
commands = {[mysqlclient]commands}

[mysql-connector]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=connector&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysql-connector-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-connector]commands}

[testenv:py34-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[testenv:py35-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[testenv:py36-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[testenv:py37-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[testenv:py38-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[testenv:py39-mysql-connector-noauto]
commands = {[mysql-connector]commands}

[oursql]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=oursql&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysql-oursql-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[oursql]commands}

[testenv:py34-mysql-oursql3-noauto]
commands = {[oursql]commands}

[testenv:py35-mysql-oursql3-noauto]
commands = {[oursql]commands}

[testenv:py36-mysql-oursql3-noauto]
commands = {[oursql]commands}

[testenv:py37-mysql-oursql3-noauto]
commands = {[oursql]commands}

[testenv:py38-mysql-oursql3-noauto]
commands = {[oursql]commands}

[testenv:py39-mysql-oursql3-noauto]
commands = {[oursql]commands}

[pymysql]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=pymysql&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pymysql]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pymysql]commands}

[testenv:py34-mysql-pymysql]
commands = {[pymysql]commands}

[testenv:py35-mysql-pymysql]
commands = {[pymysql]commands}

[testenv:py36-mysql-pymysql]
commands = {[pymysql]commands}

[testenv:py37-mysql-pymysql]
commands = {[pymysql]commands}

[testenv:py38-mysql-pymysql]
commands = {[pymysql]commands}

[testenv:py39-mysql-pymysql]
commands = {[pymysql]commands}

[mariadb]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=mariadb&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mariadb]
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py34-mariadb]
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py35-mariadb]
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py36-mariadb]
commands = {[mariadb]commands}

[testenv:py37-mariadb]
commands = {[mariadb]commands}

[testenv:py38-mariadb]
commands = {[mariadb]commands}

[testenv:py39-mariadb]
commands = {[mariadb]commands}

[mysql-pyodbc]
commands =
    {[testenv]commands}
    {envpython} -c "import pyodbc; print(pyodbc.drivers())"
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=pyodbc&odbcdrv=MySQL&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pyodbc-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-pyodbc]commands}

[testenv:py34-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[testenv:py35-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[testenv:py36-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[testenv:py37-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[testenv:py38-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[testenv:py39-mysql-pyodbc-noauto]
commands = {[mysql-pyodbc]commands}

[mysql-pypyodbc]
commands =
    {[testenv]commands}
    -mysql -uroot -e 'drop database sqlobject_test;'
    mysql -uroot -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:@localhost/sqlobject_test?driver=pypyodbc&odbcdrv=MySQL&charset=utf8&debug=1
    mysql -uroot -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pypyodbc-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-pypyodbc]commands}

[testenv:py34-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

[testenv:py35-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

[testenv:py36-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

[testenv:py37-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

[testenv:py38-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

[testenv:py39-mysql-pypyodbc-noauto]
commands = {[mysql-pypyodbc]commands}

# PostgreSQL test environments
[psycopg]
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=psycopg&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-psycopg]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[psycopg]commands}

[testenv:py34-postgres-psycopg]
commands = {[psycopg]commands}

[testenv:py35-postgres-psycopg]
commands = {[psycopg]commands}

[testenv:py36-postgres-psycopg]
commands = {[psycopg]commands}

[testenv:py37-postgres-psycopg]
commands = {[psycopg]commands}

[testenv:py38-postgres-psycopg]
commands = {[psycopg]commands}

[testenv:py39-postgres-psycopg]
commands = {[psycopg]commands}

[pygresql]
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=pygresql&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pygresql]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pygresql]commands}

[testenv:py34-postgres-pygresql]
commands = {[pygresql]commands}

[testenv:py35-postgres-pygresql]
commands = {[pygresql]commands}

[testenv:py36-postgres-pygresql]
commands = {[pygresql]commands}

[testenv:py37-postgres-pygresql]
commands = {[pygresql]commands}

[testenv:py38-postgres-pygresql]
commands = {[pygresql]commands}

[testenv:py39-postgres-pygresql]
commands = {[pygresql]commands}

[pypostgresql]
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=pypostgresql&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pypostgresql]
commands = {envpython} -c "print('pypostgresql requires Python 3.4+')"
deps =

[testenv:py34-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[testenv:py35-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[testenv:py36-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[testenv:py37-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[testenv:py38-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[testenv:py39-postgres-pypostgresql]
commands = {[pypostgresql]commands}

[pg8000]
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=pg8000&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pg8000]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pg8000]commands}

[testenv:py34-postgres-pg8000]
commands = {[pg8000]commands}

[testenv:py35-postgres-pg8000]
commands = {[pg8000]commands}

[testenv:py36-postgres-pg8000]
commands = {[pg8000]commands}

[testenv:py37-postgres-pg8000]
commands = {[pg8000]commands}

[testenv:py38-postgres-pg8000]
commands = {[pg8000]commands}

[testenv:py39-postgres-pg8000]
commands = {[pg8000]commands}

[postgres-pyodbc]
commands =
    {[testenv]commands}
    {envpython} -c "import pyodbc; print(pyodbc.drivers())"
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=pyodbc&odbcdrv=PostgreSQL%20ANSI&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pyodbc-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[postgres-pyodbc]commands}

[testenv:py34-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[testenv:py35-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[testenv:py36-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[testenv:py37-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[testenv:py38-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[testenv:py39-postgres-pyodbc-noauto]
commands = {[postgres-pyodbc]commands}

[postgres-pypyodbc]
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D postgres://postgres:@localhost/sqlobject_test?driver=pypyodbc&odbcdrv=PostgreSQL%20ANSI&charset=utf-8&debug=1 tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pypyodbc-noauto]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[postgres-pypyodbc]commands}

[testenv:py34-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}

[testenv:py35-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}

[testenv:py36-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}

[testenv:py37-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}

[testenv:py38-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}

[testenv:py39-postgres-pypyodbc-noauto]
commands = {[postgres-pypyodbc]commands}


# SQLite test environments
[sqlite]
commands =
    {[testenv]commands}
    -rm -f /tmp/sqlobject_test.sqdb
    pytest --cov=sqlobject -D sqlite:///tmp/sqlobject_test.sqdb?debug=1
    rm -f /tmp/sqlobject_test.sqdb

[testenv:py27-sqlite]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[sqlite]commands}

[testenv:py34-sqlite]
commands = {[sqlite]commands}

[testenv:py35-sqlite]
commands = {[sqlite]commands}

[testenv:py36-sqlite]
commands = {[sqlite]commands}

[testenv:py37-sqlite]
commands = {[sqlite]commands}

[testenv:py38-sqlite]
commands = {[sqlite]commands}

[testenv:py39-sqlite]
commands = {[sqlite]commands}

[sqlite-memory]
commands =
    {[testenv]commands}
    pytest --cov=sqlobject -D sqlite:/:memory:?debug=1

[testenv:py27-sqlite-memory]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[sqlite-memory]commands}

[testenv:py34-sqlite-memory]
commands = {[sqlite-memory]commands}

[testenv:py35-sqlite-memory]
commands = {[sqlite-memory]commands}

[testenv:py36-sqlite-memory]
commands = {[sqlite-memory]commands}

[testenv:py37-sqlite-memory]
commands = {[sqlite-memory]commands}

[testenv:py38-sqlite-memory]
commands = {[sqlite-memory]commands}

[testenv:py39-sqlite-memory]
commands = {[sqlite-memory]commands}

[sqlite-supersqlite]
commands =
    {[testenv]commands}
    -rm -f /tmp/sqlobject_test.sqdb
    -pytest --cov=sqlobject -D sqlite:///tmp/sqlobject_test.sqdb?driver=supersqlite&debug=1
    rm -f /tmp/sqlobject_test.sqdb

[testenv:py27-sqlite-supersqlite]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[sqlite-supersqlite]commands}

[testenv:py34-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}

[testenv:py35-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}

[testenv:py36-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}

[testenv:py37-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}

[testenv:py38-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}

[testenv:py39-sqlite-supersqlite]
commands = {[sqlite-supersqlite]commands}


# Firebird database test environments
[fdb]
commands =
    {[testenv]commands}
    sudo rm -f /tmp/test.fdb
    isql-fb -u test -p test -i /var/lib/firebird/create_test_db
    pytest --cov=sqlobject -D 'firebird://test:test@localhost/tmp/test.fdb?debug=1'
    sudo rm -f /tmp/test.fdb

[testenv:py27-firebird-fdb]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[fdb]commands}

[testenv:py34-firebird-fdb]
commands = {[fdb]commands}

[testenv:py35-firebird-fdb]
commands = {[fdb]commands}

[testenv:py36-firebird-fdb]
commands = {[fdb]commands}

[testenv:py37-firebird-fdb]
commands = {[fdb]commands}

[testenv:py38-firebird-fdb]
commands = {[fdb]commands}

[testenv:py39-firebird-fdb]
commands = {[fdb]commands}

[firebirdsql]
commands =
    {[testenv]commands}
    sudo rm -f /tmp/test.fdb
    isql-fb -u test -p test -i /var/lib/firebird/create_test_db
    pytest --cov=sqlobject -D 'firebird://test:test@localhost:3050/tmp/test.fdb?driver=firebirdsql&charset=utf8&debug=1'
    sudo rm -f /tmp/test.fdb

[testenv:py27-firebirdsql]
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[firebirdsql]commands}

[testenv:py34-firebirdsql]
commands = {[firebirdsql]commands}

[testenv:py35-firebirdsql]
commands = {[firebirdsql]commands}

[testenv:py36-firebirdsql]
commands = {[firebirdsql]commands}

[testenv:py37-firebirdsql]
commands = {[firebirdsql]commands}

[testenv:py38-firebirdsql]
commands = {[firebirdsql]commands}

[testenv:py39-firebirdsql]
commands = {[firebirdsql]commands}

# Special test environments
[testenv:py27-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py34-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py35-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py36-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py37-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py38-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

[testenv:py39-flake8]
changedir = ./
deps =
    flake8
commands =
    {[testenv]commands}
    flake8 .

# Windows testing
[mssql-pyodbc-w32]
platform = win32
commands =
    {envpython} -c "import pyodbc; print(pyodbc.drivers())"
    -sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"
    sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "CREATE DATABASE sqlobject_test"
    pytest --cov=sqlobject -D "mssql://sa:Password12!@localhost\SQL2014/sqlobject_test?driver=pyodbc&odbcdrv=SQL%20Server&timeout=30&debug=1"
    sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"

[testenv:py27-mssql-pyodbc-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mssql-pyodbc-w32]commands}

[testenv:py34-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[testenv:py35-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[testenv:py36-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[testenv:py37-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[testenv:py38-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[testenv:py39-mssql-pyodbc-noauto-w32]
platform = win32
commands = {[mssql-pyodbc-w32]commands}

[mysql-connector-w32]
platform = win32
commands =
    {[testenv]commands}
    -mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'
    mysql -u root "-pPassword12!" -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D "mysql://root:Password12!@localhost/sqlobject_test?driver=connector&charset=utf8&debug=1"
    mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'

[testenv:py27-mysql-connector-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-connector-w32]commands}

[testenv:py34-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[testenv:py35-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[testenv:py36-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[testenv:py37-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[testenv:py38-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[testenv:py39-mysql-connector-w32]
platform = win32
commands = {[mysql-connector-w32]commands}

[pymysql-w32]
platform = win32
commands =
    {[testenv]commands}
    -mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'
    mysql -u root "-pPassword12!" -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D "mysql://root:Password12!@localhost/sqlobject_test?driver=pymysql&charset=utf8&debug=1"
    mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pymysql-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pymysql-w32]commands}

[testenv:py34-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[testenv:py35-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[testenv:py36-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[testenv:py37-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[testenv:py38-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[testenv:py39-mysql-pymysql-w32]
platform = win32
commands = {[pymysql-w32]commands}

[mariadb-w32]
platform = win32
commands =
    {[testenv]commands}
    -mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'
    mysql -u root "-pPassword12!" -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D "mysql://root:Password12!@localhost/sqlobject_test?driver=mariadb&charset=utf8&debug=1"
    mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'

[testenv:py27-mariadb-w32]
platform = win32
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py34-mariadb-w32]
platform = win32
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py35-mariadb-w32]
platform = win32
commands = {envpython} -c "print('mariadb requires Python 3.6+')"
deps =

[testenv:py36-mariadb-w32]
platform = win32
commands = {[mariadb-w32]commands}

[testenv:py37-mariadb-w32]
platform = win32
commands = {[mariadb-w32]commands}

[testenv:py38-mariadb-w32]
platform = win32
commands = {[mariadb-w32]commands}

[testenv:py39-mariadb-w32]
platform = win32
commands = {[mariadb-w32]commands}

[mysql-pyodbc-w32]
platform = win32
commands =
    {[testenv]commands}
    {envpython} -c "import pyodbc; print(pyodbc.drivers())"
    -mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'
    mysql -u root "-pPassword12!" -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:Password12!@localhost/sqlobject_test?driver=pyodbc&odbcdrv=MySQL%20ODBC%205.3%20ANSI%20Driver&charset=utf8&debug=1
    mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pyodbc-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-pyodbc-w32]commands}

[testenv:py34-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[testenv:py35-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[testenv:py36-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[testenv:py37-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[testenv:py38-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[testenv:py39-mysql-pyodbc-noauto-w32]
platform = win32
commands = {[mysql-pyodbc-w32]commands}

[mysql-pypyodbc-w32]
platform = win32
commands =
    {[testenv]commands}
    {envpython} -c "import pypyodbc; print(pypyodbc.drivers())"
    -mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'
    mysql -u root "-pPassword12!" -e 'create database sqlobject_test;'
    pytest --cov=sqlobject -D mysql://root:Password12!@localhost/sqlobject_test?driver=pypyodbc&odbcdrv=MySQL%20ODBC%205.3%20ANSI%20Driver&charset=utf8&debug=1
    mysql -u root "-pPassword12!" -e 'drop database sqlobject_test;'

[testenv:py27-mysql-pypyodbc-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[mysql-pypyodbc-w32]commands}

[testenv:py34-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[testenv:py35-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[testenv:py36-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[testenv:py37-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[testenv:py38-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[testenv:py39-mysql-pypyodbc-noauto-w32]
platform = win32
commands = {[mysql-pypyodbc-w32]commands}

[psycopg-w32]
platform = win32
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=psycopg2&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-psycopg-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[psycopg-w32]commands}

[testenv:py34-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[testenv:py35-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[testenv:py36-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[testenv:py37-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[testenv:py38-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[testenv:py39-postgres-psycopg-w32]
platform = win32
commands = {[psycopg-w32]commands}

[pygresql-w32]
platform = win32
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    -pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=pygresql&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pygresql-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pygresql-w32]commands}

[testenv:py34-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[testenv:py35-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[testenv:py36-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[testenv:py37-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[testenv:py38-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[testenv:py39-postgres-pygresql-w32]
platform = win32
commands = {[pygresql-w32]commands}

[pypostgresql-w32]
platform = win32
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=pypostgresql&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pypostgresql-w32]
platform = win32
commands = {envpython} -c "print('pypostgresql requires Python 3.4+')"
deps =

[testenv:py34-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[testenv:py35-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[testenv:py36-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[testenv:py37-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[testenv:py38-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[testenv:py39-postgres-pypostgresql-w32]
platform = win32
commands = {[pypostgresql-w32]commands}

[pg8000-w32]
platform = win32
commands =
    {[testenv]commands}
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=pg8000&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pg8000-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[pg8000-w32]commands}

[testenv:py34-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[testenv:py35-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[testenv:py36-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[testenv:py37-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[testenv:py38-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[testenv:py39-postgres-pg8000-w32]
platform = win32
commands = {[pg8000-w32]commands}

[postgres-pyodbc-w32]
platform = win32
commands =
    {[testenv]commands}
    {envpython} -c "import pyodbc; print(pyodbc.drivers())"
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=pyodbc&odbcdrv=PostgreSQL%20ANSI%28x64%29&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pyodbc-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[postgres-pyodbc-w32]commands}

[testenv:py34-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[testenv:py35-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[testenv:py36-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[testenv:py37-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[testenv:py38-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[testenv:py39-postgres-pyodbc-noauto-w32]
platform = win32
commands = {[postgres-pyodbc-w32]commands}

[postgres-pypyodbc-w32]
platform = win32
commands =
    {[testenv]commands}
    {envpython} -c "import pypyodbc; print(pypyodbc.drivers())"
    -dropdb -U postgres -w sqlobject_test
    createdb -U postgres -w sqlobject_test
    pytest --cov=sqlobject -D "postgres://postgres:Password12!@localhost/sqlobject_test?driver=pypyodbc&odbcdrv=PostgreSQL%20ANSI%28x64%29&charset=utf-8&debug=1" tests include/tests inheritance/tests versioning/test
    dropdb -U postgres -w sqlobject_test

[testenv:py27-postgres-pypyodbc-noauto-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[postgres-pypyodbc-w32]commands}

[testenv:py34-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[testenv:py35-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[testenv:py36-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[testenv:py37-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[testenv:py38-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[testenv:py39-postgres-pypyodbc-noauto-w32]
platform = win32
commands = {[postgres-pypyodbc-w32]commands}

[sqlite-w32]
platform = win32
commands =
    {[testenv]commands}
    pytest --cov=sqlobject -D sqlite:/C:/projects/sqlobject/sqlobject_test.sqdb?debug=1
    cmd /c "del C:\projects\sqlobject\sqlobject_test.sqdb"

[testenv:py27-sqlite-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[sqlite-w32]commands}

[testenv:py34-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[testenv:py35-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[testenv:py36-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[testenv:py37-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[testenv:py38-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[testenv:py39-sqlite-w32]
platform = win32
commands = {[sqlite-w32]commands}

[sqlite-memory-w32]
platform = win32
commands =
    {[testenv]commands}
    pytest --cov=sqlobject -D sqlite:/:memory:?debug=1

[testenv:py27-sqlite-memory-w32]
platform = win32
commands =
    easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
    {[sqlite-memory-w32]commands}

[testenv:py34-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}

[testenv:py35-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}

[testenv:py36-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}

[testenv:py37-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}

[testenv:py38-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}

[testenv:py39-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}
