xref: /sqlalchemy/tox.ini (revision 3568e508)
16b051503SMike Bayer
29281e700SMike Bayer[tox]
31da9d375SMike Bayerenvlist = py{27,34,35,36}-{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
13086ad9ceSMike Bayerusedevelop=
14086ad9ceSMike Bayer     cov: True
15d100bfcfSMike Bayer
163568e508SMike Bayerdeps=pytest
173568e508SMike Bayer     pytest-xdist
189281e700SMike Bayer     mock
1966e483ebSMike Bayer     # needed only for correct profiling results
2066e483ebSMike Bayer     # due to speed improvements in psycopg2 as of 2.7
2166e483ebSMike Bayer     postgresql: psycopg2>=2.7
228d1579ccSMike Bayer     mysql: mysqlclient
238d1579ccSMike Bayer     mysql: pymysql
248d1579ccSMike Bayer     oracle: cx_oracle
258d1579ccSMike Bayer     mssql: pyodbc
268d1579ccSMike Bayer     mssql: pymssql
27d100bfcfSMike Bayer     cov: pytest-cov
289281e700SMike Bayer
2949dfeda6SMike Bayerwhitelist_externals=sh
3049dfeda6SMike Bayer
3149dfeda6SMike Bayer# PYTHONPATH - erased so that we use the build that's present
3249dfeda6SMike Bayer# in .tox as the SQLAlchemy library to be imported
3349dfeda6SMike Bayer#
3449dfeda6SMike Bayer# PYTHONUSERSITE - this *MUST* be set so that the ./lib/ import
3549dfeda6SMike Bayer# set up explicitly in test/conftest.py is *disabled*, again so that
3649dfeda6SMike Bayer# when SQLAlchemy is built into the .tox area, we use that and not the
3749dfeda6SMike Bayer# local checkout, at least when usedevelop=False
3849dfeda6SMike Bayer#
3949dfeda6SMike Bayer# BASECOMMAND - using an env variable here so we can use it
4049dfeda6SMike Bayer# as a substitution in a command (see https://bitbucket.org/hpk42/tox/issues/307/)
4149dfeda6SMike Bayer#
42ffb6fbf8SMike Bayer# only use --dropfirst option if we're *not* using -n;
43ffb6fbf8SMike Bayer# if -n is used, we're working in brand new DBs anyway, dropfirst
44ffb6fbf8SMike Bayer# will collide on CI environments
45f30e35baSMike Bayersetenv=
46f30e35baSMike Bayer    PYTHONPATH=
4749dfeda6SMike Bayer    PYTHONNOUSERSITE=1
48ffb6fbf8SMike Bayer    BASECOMMAND=python -m pytest
49086ad9ceSMike Bayer
50de1f8f83SMike Bayer    WORKERS={env:WORKERS:-n4}
51de1f8f83SMike Bayer    oracle: WORKERS={env:WORKERS:-n2}
52086ad9ceSMike Bayer    nocext: DISABLE_SQLALCHEMY_CEXT=1
53086ad9ceSMike Bayer    cov: COVERAGE={[testenv]cov_args}
54de1f8f83SMike Bayer    sqlite: SQLITE={env:SQLITE:--db sqlite}
55de1f8f83SMike Bayer    postgresql: POSTGRESQL={env:POSTGRESQL:--db postgresql}
56de1f8f83SMike Bayer    mysql: MYSQL={env:MYSQL:--db mysql --db pymysql}
57de1f8f83SMike Bayer    oracle: ORACLE={env:ORACLE:--db oracle} --write-idents oracle_idents.txt --exclude-tag memory-intensive
58de1f8f83SMike Bayer    mssql: MSSQL={env:MSSQL:--db pyodbc --db pymssql}
59086ad9ceSMike Bayer    backendonly: BACKENDONLY=--backend-only
60f30e35baSMike Bayer
617f423e87SMike Bayer# tox as of 2.0 blocks all environment variables from the
627f423e87SMike Bayer# outside, unless they are here (or in TOX_TESTENV_PASSENV,
63077f26afSMike Bayer# wildcards OK).  Need at least these
657f423e87SMike Bayer
6649dfeda6SMike Bayer# for nocext, we rm *.so in lib in case we are doing usedevelop=True
679281e700SMike Bayercommands=
68086ad9ceSMike Bayer  {nocext}: sh -c "rm -f lib/sqlalchemy/*.so"
697d2bed69SMike Bayer  {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:COVERAGE:} {posargs}
70eb28ebb0SMike Bayer  {oracle}: python reap_oracle_dbs.py oracle_idents.txt
7111a8440bSMike Bayer
729281e700SMike Bayer
739281e700SMike Bayer[testenv:pep8]
741217d6ceSMike Bayerdeps=flake8
7530ab1a02SMike Bayercommands = python -m flake8 {posargs}
769281e700SMike Bayer
779281e700SMike Bayer[flake8]
789281e700SMike Bayershow-source = True
7986660fefSMike Bayerignore = E711,E712,E721,N806,D
809281e700SMike Bayerexclude=.venv,.git,.tox,dist,doc,*egg,build