import os
if not sys.flags.no_user_site:
+ # this is needed so that test scenarios like "python setup.py test"
+ # work correctly, as well as plain "py.test". These commands assume
+ # that the package in question is locally present, but since we have
+ # ./lib/, we need to punch that in.
+ # We check no_user_site to honor the use of this flag.
sys.path.insert(
0,
os.path.join(
to_bootstrap = "pytest"
exec(code, globals(), locals())
from pytestplugin import * # noqa
+
py35-nocext-cov
[testenv]
-cov_args=--cov=sqlalchemy --cov-report term --cov-report xml --exclude-tag memory-intensive --exclude-tag timing-intensive -k "not aaa_profiling"
+# 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={env:USEDEVELOP}
deps=pytest
pytest-xdist
cov: .[mysql]
cov: .[postgresql]
-# -E : ignore PYTHON* environment variables (such as PYTHONPATH)
-# BASECOMMAND: we can't do section subtitutions in commands
-# (see https://bitbucket.org/hpk42/tox/issues/307/)
+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/)
+#
+# USEDEVELOP - also an env variable because we can't otherwise use a factor
+# to control the value of the "usedevelop" setting (should also be a tox bug)
+# We want develop=True when coverage is in play, because coverage is
+# always against the files physically in ./lib. We are doing an aggregate
+# of coverage into one file across multiple test runs.
+#
setenv=
PYTHONPATH=
+ PYTHONNOUSERSITE=1
+ USEDEVELOP=False
nocext: DISABLE_SQLALCHEMY_CEXT=1
BASECOMMAND=python -m pytest -n4 --dropfirst
- cov: BASECOMMAND=python -m pytest -n4 --dropfirst {[testenv]cov_args}
+ cov: BASECOMMAND=python -m pytest -n4 --dropfirst {[testenv]cov_args}
+ cov: USEDEVELOP=True
# 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
+# for nocext, we rm *.so in lib in case we are doing usedevelop=True
commands=
+ nocext: sh -c "rm -f lib/sqlalchemy/*.so"
default: {env:BASECOMMAND} {posargs}
sqlitepg: {env:BASECOMMAND} --db sqlite --db postgresql {posargs}
mysql: {env:BASECOMMAND} --db mysql --db pymysql {posargs}
deps=flake8
commands = python -m flake8 {posargs}
-
[flake8]
show-source = True
ignore = E711,E712,E721,N806