xref: /sqlalchemy/tox.ini (revision 3231e281)
16b051503SMike Bayer
29281e700SMike Bayer[tox]
3c312b3b2SMike Bayerenvlist = py
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
205fb0138aSMike Bayer     greenlet
210396fb76SMike Bayer     mock; python_version < '3.3'
22cd03b8f0SMike Bayer     importlib_metadata; python_version < '3.8'
23897cd176SMike Bayer     postgresql: .[postgresql]
245fb0138aSMike Bayer     postgresql: .[postgresql_asyncpg]
25897cd176SMike Bayer     mysql: .[mysql]
26897cd176SMike Bayer     mysql: .[pymysql]
27897cd176SMike Bayer     oracle: .[oracle]
28897cd176SMike Bayer     mssql: .[mssql]
29d1fe8f43SMike Bayer
30d100bfcfSMike Bayer     cov: pytest-cov
319281e700SMike Bayer
3249dfeda6SMike Bayerwhitelist_externals=sh
3349dfeda6SMike Bayer
3449dfeda6SMike Bayer# PYTHONPATH - erased so that we use the build that's present
3549dfeda6SMike Bayer# in .tox as the SQLAlchemy library to be imported
3649dfeda6SMike Bayer#
3749dfeda6SMike Bayer# PYTHONUSERSITE - this *MUST* be set so that the ./lib/ import
3849dfeda6SMike Bayer# set up explicitly in test/conftest.py is *disabled*, again so that
3949dfeda6SMike Bayer# when SQLAlchemy is built into the .tox area, we use that and not the
4049dfeda6SMike Bayer# local checkout, at least when usedevelop=False
4149dfeda6SMike Bayer#
4249dfeda6SMike Bayer# BASECOMMAND - using an env variable here so we can use it
4349dfeda6SMike Bayer# as a substitution in a command (see https://bitbucket.org/hpk42/tox/issues/307/)
4449dfeda6SMike Bayer#
45ffb6fbf8SMike Bayer# only use --dropfirst option if we're *not* using -n;
46ffb6fbf8SMike Bayer# if -n is used, we're working in brand new DBs anyway, dropfirst
47ffb6fbf8SMike Bayer# will collide on CI environments
48f30e35baSMike Bayersetenv=
49f30e35baSMike Bayer    PYTHONPATH=
5049dfeda6SMike Bayer    PYTHONNOUSERSITE=1
51e2d4b2e7SMike Bayer    MEMUSAGE=--nomemory
5200309662SMike Bayer    BASECOMMAND=python -m pytest --log-info=sqlalchemy.testing
53086ad9ceSMike Bayer
543ceb87daSMike Bayer    WORKERS={env:TOX_WORKERS:-n4  --max-worker-restart=5}
553231e281SMike Bayer
56086ad9ceSMike Bayer    nocext: DISABLE_SQLALCHEMY_CEXT=1
57a54a0c6eSMike Bayer    cext: REQUIRE_SQLALCHEMY_CEXT=1
58086ad9ceSMike Bayer    cov: COVERAGE={[testenv]cov_args}
593231e281SMike Bayer    backendonly: BACKENDONLY=--backend-only
603231e281SMike Bayer    memusage: MEMUSAGE='-k test_memusage'
613231e281SMike Bayer
623231e281SMike Bayer    oracle: WORKERS={env:TOX_WORKERS:-n2  --max-worker-restart=5}
633231e281SMike Bayer    oracle: ORACLE={env:TOX_ORACLE:--db oracle}
643231e281SMike Bayer
659e6393c6SMike Bayer    sqlite: SQLITE={env:TOX_SQLITE:--db sqlite}
6679a53645SGord Thompson    sqlite_file: SQLITE={env:TOX_SQLITE_FILE:--db sqlite_file}
673231e281SMike Bayer
683231e281SMike Bayer    postgresql: POSTGRESQL={env:TOX_POSTGRESQL:--db postgresql}
693231e281SMike Bayer    postgresql: EXTRA_PG_DRIVERS={env:EXTRA_PG_DRIVERS:--dbdriver psycopg2 --dbdriver asyncpg}
703231e281SMike Bayer
713231e281SMike Bayer    mysql: MYSQL={env:TOX_MYSQL:--db mysql}
723231e281SMike Bayer    mysql: EXTRA_MYSQL_DRIVERS={env:EXTRA_MYSQL_DRIVERS:--dbdriver mysqldb --dbdriver pymysql}
733231e281SMike Bayer
74f87570acSMike Bayer    mssql: MSSQL={env:TOX_MSSQL:--db mssql}
753231e281SMike Bayer
7679a53645SGord Thompson    oracle,mssql,sqlite_file: IDENTS=--write-idents db_idents.txt
77e2d4b2e7SMike Bayer    oracle,mssql,sqlite_file: MEMUSAGE=--nomemory
78f30e35baSMike Bayer
797f423e87SMike Bayer# tox as of 2.0 blocks all environment variables from the
807f423e87SMike Bayer# outside, unless they are here (or in TOX_TESTENV_PASSENV,
81077f26afSMike Bayer# wildcards OK).  Need at least these
837f423e87SMike Bayer
8449dfeda6SMike Bayer# for nocext, we rm *.so in lib in case we are doing usedevelop=True
859281e700SMike Bayercommands=
86c312b3b2SMike Bayer  cext: /bin/true
872efd89d0SMike Bayer  nocext: sh -c "rm -f lib/sqlalchemy/*.so"
883231e281SMike Bayer  {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:EXTRA_PG_DRIVERS:} {env:MYSQL:} {env:EXTRA_MYSQL_DRIVERS:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:MEMUSAGE:} {env:COVERAGE:} {posargs}
8979a53645SGord Thompson  oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt
909281e700SMike Bayer
91d229360aSMike Bayer# thanks to https://julien.danjou.info/the-best-flake8-extensions/
929281e700SMike Bayer[testenv:pep8]
93b9d9d416SMike Bayerbasepython = python3.7
94d229360aSMike Bayerdeps=
95d229360aSMike Bayer      flake8
96d229360aSMike Bayer      flake8-import-order
97d229360aSMike Bayer      flake8-builtins
98a55a1a41SMike Bayer      flake8-docstrings>=1.3.1
99d229360aSMike Bayer      flake8-rst-docstrings
100a55a1a41SMike Bayer      # flake8-rst-docstrings depdendency, leaving it here
101a55a1a41SMike Bayer      # in case it requires a version pin
102a55a1a41SMike Bayer      pydocstyle
103d229360aSMike Bayer      pygments
104d8378f45SFederico Caselli      black==19.10b0
105d8378f45SFederico Casellicommands =
1067ff6cf1eSMike Bayer     flake8 ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py {posargs}
107d8378f45SFederico Caselli     black --check .
108c658540bSFederico Caselli
109c658540bSFederico Caselli# command run in the github action when cext are active.
110c658540bSFederico Caselli[testenv:github-cext]
111c658540bSFederico Casellicommands=
112e2d4b2e7SMike Bayer  python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:MEMUSAGE:} {env:COVERAGE:} {posargs}
113c658540bSFederico Caselli  oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt
114c658540bSFederico Caselli
115c658540bSFederico Caselli# command run in the github action when cext are not active.
116c658540bSFederico Caselli[testenv:github-nocext]
117c658540bSFederico Casellicommands=
118e2d4b2e7SMike Bayer  python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:MEMUSAGE:} {env:COVERAGE:} {posargs}
1197ff6cf1eSMike Bayer  oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt