.. changelog::
:version: 1.0.0
+ .. change::
+ :tags: bug, tests
+ :tickets: 3356
+
+ Fixed the pathing used when tests run; for sqla_nose.py and py.test,
+ the "./lib" prefix is again inserted at the head of sys.path but
+ only if sys.flags.no_user_site isn't set; this makes it act just
+ like the way Python puts "." in the current path by default.
+ For tox, we are setting the PYTHONNOUSERSITE flag now.
+
.. change::
:tags: feature, sql
:tickets: 3084
py{27}-sqla_{cext,nocext}-db_{mysql}: mysql-python
py{33,34}-sqla_{cext,nocext}-db_{mysql}: pymysql
-usedevelop=False
-sitepackages=True
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
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
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
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
+# the latter is picked up by conftest.py
+setenv=
+ PYTHONPATH=
+ PYTHONNOUSERSITE=1
+
+# don't accidentally use a SQLAlchemy that's globally installed during pip;
+# unfortunately, without usedevelop, no easy way to use systemwide
+# site-packages for dependencies
+sitepackages=False
+
+# always install fully and use that; this way options like
+# DISABLE_SQLALCHEMY_CEXT are honored
+usedevelop=False
+
commands=
python -m pytest {posargs}