From: Mike Bayer Date: Thu, 29 Jun 2006 00:28:55 +0000 (+0000) Subject: inserting './lib/' into sys.path since PYTHONPATH no longer straightforward with... X-Git-Tag: rel_0_2_5~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3927fbb88c7988ec0397241ff40ecd72d1727bf;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git inserting './lib/' into sys.path since PYTHONPATH no longer straightforward with latest setuptools --- diff --git a/CHANGES b/CHANGES index 9de4b105bb..5b90beab0e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ 0.2.5 - fixed endless loop bug in select_by(), if the traversal hit two mappers that referenced each other +- upgraded all unittests to insert './lib/' into sys.path, +working around new setuptools PYTHONPATH-killing behavior 0.2.4 - try/except when the mapper sets init.__name__ on a mapped class, diff --git a/README.unittests b/README.unittests index 74c7ccac13..1e11873da4 100644 --- a/README.unittests +++ b/README.unittests @@ -4,7 +4,10 @@ cd into the SQLAlchemy distribution directory. Set up the PYTHONPATH: - export PYTHONPATH=./lib/:./test/ + export PYTHONPATH=./test/ + +The unittest framework will automatically prepend './lib/' to sys.path. this forces the local +version to run, bypassing any setuptools-installed installations. To run all tests: diff --git a/test/__init__.py b/test/__init__.py index 139597f9cb..8b13789179 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,2 +1 @@ - diff --git a/test/engine/autoconnect_engine.py b/test/engine/autoconnect_engine.py index 39bcf3e536..69c2c33f54 100644 --- a/test/engine/autoconnect_engine.py +++ b/test/engine/autoconnect_engine.py @@ -1,8 +1,8 @@ +from testbase import PersistTest +import testbase from sqlalchemy import * from sqlalchemy.ext.proxy import AutoConnectEngine -from testbase import PersistTest -import testbase import os # diff --git a/test/engine/proxy_engine.py b/test/engine/proxy_engine.py index df0c64398b..d468e946f2 100644 --- a/test/engine/proxy_engine.py +++ b/test/engine/proxy_engine.py @@ -1,10 +1,10 @@ +from testbase import PersistTest +import testbase import os from sqlalchemy import * from sqlalchemy.ext.proxy import ProxyEngine -from testbase import PersistTest -import testbase # # Define an engine, table and mapper at the module level, to show that the diff --git a/test/engine/reflection.py b/test/engine/reflection.py index d4e507464b..f9fa4e40c5 100644 --- a/test/engine/reflection.py +++ b/test/engine/reflection.py @@ -1,11 +1,11 @@ +from testbase import PersistTest +import testbase import sqlalchemy.ansisql as ansisql from sqlalchemy import * from sqlalchemy.exceptions import NoSuchTableError -from testbase import PersistTest -import testbase import unittest, re, StringIO class ReflectionTest(PersistTest): diff --git a/test/ext/activemapper.py b/test/ext/activemapper.py index f33d3d9bbd..ef6886a785 100644 --- a/test/ext/activemapper.py +++ b/test/ext/activemapper.py @@ -1,12 +1,11 @@ +import testbase from sqlalchemy.ext.activemapper import ActiveMapper, column, one_to_many, one_to_one, objectstore from sqlalchemy import and_, or_, clear_mappers from sqlalchemy import ForeignKey, String, Integer, DateTime from datetime import datetime -import unittest import sqlalchemy.ext.activemapper as activemapper -import testbase class testcase(testbase.PersistTest): def setUpAll(self): diff --git a/test/orm/compile.py b/test/orm/compile.py index 007edd5964..3268b9230a 100644 --- a/test/orm/compile.py +++ b/test/orm/compile.py @@ -1,5 +1,5 @@ -from sqlalchemy import * import testbase +from sqlalchemy import * class CompileTest(testbase.AssertMixin): """test various mapper compilation scenarios""" diff --git a/test/orm/inheritance2.py b/test/orm/inheritance2.py index 9df29f9c9c..5ce485ef4e 100644 --- a/test/orm/inheritance2.py +++ b/test/orm/inheritance2.py @@ -1,6 +1,6 @@ +import testbase from sqlalchemy import * from datetime import datetime -import testbase class InheritTest(testbase.AssertMixin): """tests some various inheritance round trips involving a particular set of polymorphic inheritance relationships""" diff --git a/test/orm/inheritance3.py b/test/orm/inheritance3.py index eb8ac5a896..6a9765b3ae 100644 --- a/test/orm/inheritance3.py +++ b/test/orm/inheritance3.py @@ -1,6 +1,5 @@ -from sqlalchemy import * import testbase - +from sqlalchemy import * class BaseObject(object): def __init__(self, *args, **kwargs): diff --git a/test/orm/onetoone.py b/test/orm/onetoone.py index 5dc5b1204a..525c8db7e8 100644 --- a/test/orm/onetoone.py +++ b/test/orm/onetoone.py @@ -1,5 +1,5 @@ -from sqlalchemy import * import testbase +from sqlalchemy import * from sqlalchemy.ext.sessioncontext import SessionContext class Jack(object): diff --git a/test/orm/poly_linked_list.py b/test/orm/poly_linked_list.py index 0dfeb31845..527b81148d 100644 --- a/test/orm/poly_linked_list.py +++ b/test/orm/poly_linked_list.py @@ -1,5 +1,5 @@ -from sqlalchemy import * import testbase +from sqlalchemy import * class PolymorphicCircularTest(testbase.PersistTest): def setUpAll(self): diff --git a/test/perf/masscreate.py b/test/perf/masscreate.py index 5f99bb6c18..e603e2c002 100644 --- a/test/perf/masscreate.py +++ b/test/perf/masscreate.py @@ -1,4 +1,6 @@ # times how long it takes to create 26000 objects +import sys +sys.path.insert(0, './lib/') from sqlalchemy.attributes import * import time diff --git a/test/perf/masscreate2.py b/test/perf/masscreate2.py index f261f832ce..3a68f3612d 100644 --- a/test/perf/masscreate2.py +++ b/test/perf/masscreate2.py @@ -1,3 +1,6 @@ +import sys +sys.path.insert(0, './lib/') + import gc import random, string diff --git a/test/perf/massload2.py b/test/perf/massload2.py index 955e2b2831..1506ca5030 100644 --- a/test/perf/massload2.py +++ b/test/perf/massload2.py @@ -1,3 +1,6 @@ +import sys +sys.path.insert(0, './lib/') + try: # import sqlalchemy.mods.threadlocal pass @@ -70,4 +73,4 @@ print len([s for s in sess]) print "flushing" sess.flush() total = time.time() - now -print "done,total time", total \ No newline at end of file +print "done,total time", total diff --git a/test/rundocs.py b/test/rundocs.py index 3ed7d815ee..1918e55bec 100644 --- a/test/rundocs.py +++ b/test/rundocs.py @@ -1,5 +1,6 @@ from sqlalchemy import * import sys +sys.path.insert(0, './lib/') engine = create_engine('sqlite://') diff --git a/test/session.py b/test/session.py deleted file mode 100644 index 9ed7f0f7ad..0000000000 --- a/test/session.py +++ /dev/null @@ -1,7 +0,0 @@ - -# test merging a composed object. - -# test that when cascading an operation, like "merge", lazy-loaded scalar and list attributes that werent already loaded on the given object remain not loaded. - -# test putting an object in session A, "moving" it to session B, insure its in B and not in A - diff --git a/test/sql/indexes.py b/test/sql/indexes.py index f1e55e406f..ec72beda39 100644 --- a/test/sql/indexes.py +++ b/test/sql/indexes.py @@ -1,6 +1,6 @@ +import testbase from sqlalchemy import * import sys -import testbase class IndexTest(testbase.AssertMixin): diff --git a/test/sql/select.py b/test/sql/select.py index d78f36b1ad..57b123fc28 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -1,9 +1,8 @@ - +from testbase import PersistTest +import testbase from sqlalchemy import * from sqlalchemy.databases import sqlite, postgres, mysql, oracle -from testbase import PersistTest import unittest, re -import testbase # the select test now tests almost completely with TableClause/ColumnClause objects, # which are free-roaming table/column objects not attached to any database. diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py index 2ec1fe7957..71c98f105b 100644 --- a/test/sql/testtypes.py +++ b/test/sql/testtypes.py @@ -1,7 +1,7 @@ -from sqlalchemy import * -import string,datetime, re, sys from testbase import PersistTest, AssertMixin import testbase +from sqlalchemy import * +import string,datetime, re, sys import sqlalchemy.engine.url as url import sqlalchemy.types diff --git a/test/testbase.py b/test/testbase.py index 0ec494bae4..8fbd6954c9 100644 --- a/test/testbase.py +++ b/test/testbase.py @@ -1,10 +1,13 @@ +import sys +sys.path.insert(0, './lib/') + import unittest import StringIO import sqlalchemy.engine as engine import sqlalchemy.ext.proxy as proxy import sqlalchemy.pool as pool #import sqlalchemy.schema as schema -import re, sys +import re import sqlalchemy import optparse