[Sqlalchemy-tickets] Issue #3356: tox doesn't run the correct code and setting up lib is not reliab
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2015-04-04 22:38:53
|
New issue 3356: tox doesn't run the correct code and setting up lib is not reliable https://bitbucket.org/zzzeek/sqlalchemy/issue/3356/tox-doesnt-run-the-correct-code-and Mike Bayer: patch, needs further testing: ``` #!diff diff --git a/regen_callcounts.tox.ini b/regen_callcounts.tox.ini index 056208c..e74ceef 100644 --- a/regen_callcounts.tox.ini +++ b/regen_callcounts.tox.ini @@ -12,8 +12,6 @@ deps=pytest py{27}-sqla_{cext,nocext}-db_{mysql}: mysql-python py{33,34}-sqla_{cext,nocext}-db_{mysql}: pymysql -usedevelop=False -sitepackages=True commands= @@ -22,7 +20,11 @@ commands= db_{postgresql}: {[base]basecommand} --db postgresql {posargs} db_{sqlite}: {[base]basecommand} --db sqlite {posargs} +# -E : ignore PYTHON* environment variables (such as PYTHONPATH) +# -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE setenv= - sqla_nocext: DISABLE_SQLALCHEMY_CEXT=1 + PYTHONPATH= + PYTHONNOUSERSITE=1 + sqla_nocext: DISABLE_SQLALCHEMY_CEXT=1 diff --git a/sqla_nose.py b/sqla_nose.py index fc55f34..3925fb7 100755 --- a/sqla_nose.py +++ b/sqla_nose.py @@ -10,10 +10,9 @@ import sys import nose import os - -for pth in ['./lib']: - sys.path.append( - os.path.join(os.path.dirname(os.path.abspath(__file__)), pth)) +if not sys.flags.no_user_site: + sys.path.insert(0, + os.path.join(os.path.dirname(os.path.abspath(__file__)), './lib')) # use bootstrapping so that test plugins are loaded # without touching the main library before coverage starts diff --git a/test/conftest.py b/test/conftest.py index 590b357..7572ecc 100755 --- a/test/conftest.py +++ b/test/conftest.py @@ -9,10 +9,9 @@ installs SQLAlchemy's testing plugin into the local environment. import sys import os -for pth in ['../lib']: - sys.path.append( - os.path.join(os.path.dirname(os.path.abspath(__file__)), pth)) - +if not sys.flags.no_user_site: + sys.path.insert(0, + os.path.join(os.path.dirname(os.path.abspath(__file__)), './lib')) # use bootstrapping so that test plugins are loaded # without touching the main library before coverage starts diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 08afc32..aaba249 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -79,6 +79,8 @@ class QueryTest(fixtures.TestBase): """test that executemany parameters are asserted to match the parameter set of the first.""" + import pdb + pdb.set_trace() assert_raises_message( exc.StatementError, r"\(sqlalchemy.exc.InvalidRequestError\) A value is required for " diff --git a/tox.ini b/tox.ini index 3b1d2ea..34f40e2 100644 --- a/tox.ini +++ b/tox.ini @@ -5,8 +5,15 @@ envlist = full,py26,py27,py33,py34 deps=pytest mock -sitepackages=True -usedevelop=True +# -E : ignore PYTHON* environment variables (such as PYTHONPATH) +# -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE +setenv= + PYTHONPATH= + PYTHONNOUSERSITE=1 + +sitepackages=False +usedevelop=False + commands= python -m pytest {posargs} ``` |