]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed the pathing used when tests run; for sqla_nose.py and py.test,
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Apr 2015 23:08:18 +0000 (19:08 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Apr 2015 23:08:18 +0000 (19:08 -0400)
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.
fixes #3356

doc/build/changelog/changelog_10.rst
regen_callcounts.tox.ini
sqla_nose.py
test/conftest.py
tox.ini

index 7b101389d21c7a9aeee87f4a444489183584ea3f..6f2e1542b431b17ed9fd80f7db8f31a057f3b4aa 100644 (file)
 .. 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
index 056208ca67a9682b87416926deec074eb0673413..e74ceef362c529737948b5c78cc01116eb363d66 100644 (file)
@@ -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
 
 
index fc55f34f78c1ae0ac44101c8bab35b988be47870..fe5c4d00bc7e5623c550c804625f635a43c32cd7 100755 (executable)
@@ -10,10 +10,11 @@ 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
index 590b357005812866fdd6d179efdbb5c370be868f..36dfaa79267a5bc8ac5b9122f9101b4120322316 100755 (executable)
@@ -9,10 +9,12 @@ 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/tox.ini b/tox.ini
index 3b1d2eae551d63d53412f3f9b7eabbb98cbdd017..8cd41908c6237c0fc0c5b3a43d9947af507218aa 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,22 @@ 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
+# 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}