summaryrefslogtreecommitdiff
path: root/tox.ini
blob: bad98c9c5fd3b951e01692f6f493476df93f4801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

[tox]
envlist = py{27,34,35,36}-{cext,nocext}

[testenv]
# note that we have a .coveragerc file that points coverage specifically
# at ./lib/sqlalchemy, and *not* at the build that tox might create under .tox.
# See the notes below for setenv for more detail.
# also using --cov-append so that we can aggregate multiple runs together.
# Jenkins etc. need to call "coverage erase" externally.
cov_args=--cov=sqlalchemy --cov-report term --cov-append --cov-report xml --exclude-tag memory-intensive --exclude-tag timing-intensive -k "not aaa_profiling"

usedevelop=
     cov: True

deps=pytest
     pytest-xdist
     mock
     # needed only for correct profiling results
     # due to speed improvements in psycopg2 as of 2.7
     postgresql: psycopg2>=2.7
     mysql: mysqlclient
     mysql: pymysql
     # waiting for https://github.com/oracle/python-cx_Oracle/issues/75
     oracle: cx_oracle>=6.0.2
     oracle5: cx_oracle==5.2.1
     mssql: pyodbc
     mssql: pymssql
     cov: pytest-cov

whitelist_externals=sh

# PYTHONPATH - erased so that we use the build that's present
# in .tox as the SQLAlchemy library to be imported
#
# PYTHONUSERSITE - this *MUST* be set so that the ./lib/ import
# set up explicitly in test/conftest.py is *disabled*, again so that
# when SQLAlchemy is built into the .tox area, we use that and not the
# local checkout, at least when usedevelop=False
#
# BASECOMMAND - using an env variable here so we can use it
# as a substitution in a command (see https://bitbucket.org/hpk42/tox/issues/307/)
#
# only use --dropfirst option if we're *not* using -n;
# if -n is used, we're working in brand new DBs anyway, dropfirst
# will collide on CI environments
setenv=
    PYTHONPATH=
    PYTHONNOUSERSITE=1
    BASECOMMAND=python -m pytest --log-info=sqlalchemy.testing

    WORKERS={env:TOX_WORKERS:-n4}
    oracle,oracle5: WORKERS={env:TOX_WORKERS:-n2}
    nocext: DISABLE_SQLALCHEMY_CEXT=1
    cov: COVERAGE={[testenv]cov_args}
    sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
    postgresql: POSTGRESQL={env:TOX_POSTGRESQL:--db postgresql}
    mysql: MYSQL={env:TOX_MYSQL:--db mysql --db pymysql}
    oracle,oracle5: ORACLE={env:TOX_ORACLE:--db oracle}
    mssql: MSSQL={env:TOX_MSSQL:--db mssql --db mssql_pymssql}
    oracle,oracle5,mssql: IDENTS=--write-idents db_idents.txt
    oracle,oracle5,mssql: NOMEMORY=--nomemory
    backendonly: BACKENDONLY=--backend-only

# 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 TOX_POSTGRESQL TOX_MYSQL TOX_ORACLE TOX_MSSQL TOX_SQLITE TOX_WORKERS

# for nocext, we rm *.so in lib in case we are doing usedevelop=True
commands=
  nocext: sh -c "rm -f lib/sqlalchemy/*.so"
  {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
  oracle,oracle5,mssql: python reap_dbs.py db_idents.txt

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

[flake8]
show-source = True
ignore = E711,E712,E721,N806,D
exclude=.venv,.git,.tox,dist,doc,*egg,build