xref: /sqlalchemy/tox.ini (revision 0396fb76)
16b051503SMike Bayer
29281e700SMike Bayer[tox]
3243f9804SMike Bayerenvlist = py{27,34,35,36,37}-{cext,nocext}
49281e700SMike Bayer
59281e700SMike Bayer[testenv]
649dfeda6SMike Bayer# note that we have a .coveragerc file that points coverage specifically
749dfeda6SMike Bayer# at ./lib/sqlalchemy, and *not* at the build that tox might create under .tox.
849dfeda6SMike Bayer# See the notes below for setenv for more detail.
949dfeda6SMike Bayer# also using --cov-append so that we can aggregate multiple runs together.
1049dfeda6SMike Bayer# Jenkins etc. need to call "coverage erase" externally.
1149dfeda6SMike Bayercov_args=--cov=sqlalchemy --cov-report term --cov-append --cov-report xml --exclude-tag memory-intensive --exclude-tag timing-intensive -k "not aaa_profiling"
1249dfeda6SMike Bayer
13f704f47aSMike Bayerinstall_command=python -m pip install {env:TOX_PIP_OPTS:} {opts} {packages}
1422800000SMike Bayer
15086ad9ceSMike Bayerusedevelop=
16086ad9ceSMike Bayer     cov: True
17d100bfcfSMike Bayer
18664290abSMike Bayerdeps=pytest!=3.9.1,!=3.9.2
193568e508SMike Bayer     pytest-xdist
200396fb76SMike Bayer     mock; python_version < '3.3'
2166e483ebSMike Bayer     # needed only for correct profiling results
2266e483ebSMike Bayer     # due to speed improvements in psycopg2 as of 2.7
2366e483ebSMike Bayer     postgresql: psycopg2>=2.7
2426564407SMike Bayer
2526564407SMike Bayer     # needed only for correct profiling results
2626564407SMike Bayer     # due to speed improvements in mysqlclient as of 1.4.0
2726564407SMike Bayer     mysql: mysqlclient>=1.4.0
288d1579ccSMike Bayer     mysql: pymysql
2983750628SMike Bayer     mysql: mysql-connector-python
30de73c6d1SMike Bayer     # waiting for https://github.com/oracle/python-cx_Oracle/issues/75
3167a2cd92SMike Bayer     oracle: cx_oracle>=7.0
3267a2cd92SMike Bayer     oracle6: cx_oracle>=6.0.2,!=6.3,!=6.4,<7.0
332e137b39SMike Bayer     oracle5: cx_oracle==5.2.1
348d1579ccSMike Bayer     mssql: pyodbc
358d1579ccSMike Bayer     mssql: pymssql
36d100bfcfSMike Bayer     cov: pytest-cov
379281e700SMike Bayer
3849dfeda6SMike Bayerwhitelist_externals=sh
3949dfeda6SMike Bayer
4049dfeda6SMike Bayer# PYTHONPATH - erased so that we use the build that's present
4149dfeda6SMike Bayer# in .tox as the SQLAlchemy library to be imported
4249dfeda6SMike Bayer#
4349dfeda6SMike Bayer# PYTHONUSERSITE - this *MUST* be set so that the ./lib/ import
4449dfeda6SMike Bayer# set up explicitly in test/conftest.py is *disabled*, again so that
4549dfeda6SMike Bayer# when SQLAlchemy is built into the .tox area, we use that and not the
4649dfeda6SMike Bayer# local checkout, at least when usedevelop=False
4749dfeda6SMike Bayer#
4849dfeda6SMike Bayer# BASECOMMAND - using an env variable here so we can use it
4949dfeda6SMike Bayer# as a substitution in a command (see https://bitbucket.org/hpk42/tox/issues/307/)
5049dfeda6SMike Bayer#
51ffb6fbf8SMike Bayer# only use --dropfirst option if we're *not* using -n;
52ffb6fbf8SMike Bayer# if -n is used, we're working in brand new DBs anyway, dropfirst
53ffb6fbf8SMike Bayer# will collide on CI environments
54f30e35baSMike Bayersetenv=
55f30e35baSMike Bayer    PYTHONPATH=
5649dfeda6SMike Bayer    PYTHONNOUSERSITE=1
5700309662SMike Bayer    BASECOMMAND=python -m pytest --log-info=sqlalchemy.testing
58086ad9ceSMike Bayer
599e6393c6SMike Bayer    WORKERS={env:TOX_WORKERS:-n4}
6067a2cd92SMike Bayer    oracle,oracle6,oracle5: WORKERS={env:TOX_WORKERS:-n2}
61086ad9ceSMike Bayer    nocext: DISABLE_SQLALCHEMY_CEXT=1
62086ad9ceSMike Bayer    cov: COVERAGE={[testenv]cov_args}
639e6393c6SMike Bayer    sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
649e6393c6SMike Bayer    postgresql: POSTGRESQL={env:TOX_POSTGRESQL:--db postgresql}
659e6393c6SMike Bayer    mysql: MYSQL={env:TOX_MYSQL:--db mysql --db pymysql}
6667a2cd92SMike Bayer    oracle,oracle6,oracle5: ORACLE={env:TOX_ORACLE:--db oracle}
672efd89d0SMike Bayer    mssql: MSSQL={env:TOX_MSSQL:--db mssql --db mssql_pymssql}
6867a2cd92SMike Bayer    oracle,oracle6,oracle5,mssql: IDENTS=--write-idents db_idents.txt
6967a2cd92SMike Bayer    oracle,oracle6,oracle5,mssql: NOMEMORY=--nomemory
70086ad9ceSMike Bayer    backendonly: BACKENDONLY=--backend-only
71f30e35baSMike Bayer
727f423e87SMike Bayer# tox as of 2.0 blocks all environment variables from the
737f423e87SMike Bayer# outside, unless they are here (or in TOX_TESTENV_PASSENV,
74077f26afSMike Bayer# wildcards OK).  Need at least these
767f423e87SMike Bayer
7749dfeda6SMike Bayer# for nocext, we rm *.so in lib in case we are doing usedevelop=True
789281e700SMike Bayercommands=
792efd89d0SMike Bayer  nocext: sh -c "rm -f lib/sqlalchemy/*.so"
802efd89d0SMike Bayer  {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
8167a2cd92SMike Bayer  oracle,oracle6,oracle5,mssql: python reap_dbs.py db_idents.txt
829281e700SMike Bayer
83d229360aSMike Bayer# thanks to https://julien.danjou.info/the-best-flake8-extensions/
849281e700SMike Bayer[testenv:pep8]
85b9d9d416SMike Bayerbasepython = python3.7
86d229360aSMike Bayerdeps=
87d229360aSMike Bayer      flake8
88d229360aSMike Bayer      flake8-import-order
89d229360aSMike Bayer      flake8-builtins
90d229360aSMike Bayer      flake8-docstrings
91d229360aSMike Bayer      flake8-rst-docstrings
921a9f5754SMike Bayer      pydocstyle<4.0.0
93d229360aSMike Bayer      # used by flake8-rst-docstrings
94d229360aSMike Bayer      pygments
9552044c78SMike Bayercommands = flake8 ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py