summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-02-06 19:22:44 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-02-06 19:22:44 +0000
commit6809b2b334a7a1719f2fea5efffe8088ac5a4eda (patch)
tree1a91c9f6f4a5c2e2e4cc48270928b46f2b159e4e
parent1c16c47a47a6b66f5267eb915192b9e2f8674972 (diff)
downloadsqlalchemy-6809b2b334a7a1719f2fea5efffe8088ac5a4eda.tar.gz
- fixed "remote_side" in testrelationonbaseclass [ticket:461]
- added --reversetop arg to testbase to allow reversing the input collection for topological sorts, to better reveal dependency issues
-rw-r--r--test/orm/inheritance5.py6
-rw-r--r--test/testbase.py17
2 files changed, 18 insertions, 5 deletions
diff --git a/test/orm/inheritance5.py b/test/orm/inheritance5.py
index 8a0c909af..6c093bf9d 100644
--- a/test/orm/inheritance5.py
+++ b/test/orm/inheritance5.py
@@ -6,7 +6,7 @@ class AttrSettable(object):
def __init__(self, **kwargs):
[setattr(self, k, v) for k, v in kwargs.iteritems()]
def __repr__(self):
- return self.__class__.__name__ + ' ' + ','.join(["%s=%s" % (k,v) for k, v in self.__dict__.iteritems() if k[0] != '_'])
+ return self.__class__.__name__ + "(%s)" % (hex(id(self)))
class RelationTest1(testbase.ORMTest):
@@ -233,7 +233,7 @@ class RelationTest3(testbase.ORMTest):
if usedata:
mapper(Person, people, select_table=poly_union, polymorphic_identity='person', polymorphic_on=people.c.type,
properties={
- 'colleagues':relation(Person, primaryjoin=people.c.colleague_id==people.c.person_id, remote_side=people.c.colleague_id, uselist=True),
+ 'colleagues':relation(Person, primaryjoin=people.c.colleague_id==people.c.person_id, remote_side=people.c.person_id, uselist=True),
'data':relation(Data, uselist=False)
}
)
@@ -241,7 +241,7 @@ class RelationTest3(testbase.ORMTest):
mapper(Person, people, select_table=poly_union, polymorphic_identity='person', polymorphic_on=people.c.type,
properties={
'colleagues':relation(Person, primaryjoin=people.c.colleague_id==people.c.person_id,
- remote_side=people.c.colleague_id, uselist=True)
+ remote_side=people.c.person_id, uselist=True)
}
)
diff --git a/test/testbase.py b/test/testbase.py
index bc5153af0..b35c5e7ff 100644
--- a/test/testbase.py
+++ b/test/testbase.py
@@ -51,7 +51,8 @@ def parse_argv():
parser.add_option("--nothreadlocal", action="store_true", dest="nothreadlocal", help="dont use thread-local mod")
parser.add_option("--enginestrategy", action="store", default=None, dest="enginestrategy", help="engine strategy (plain or threadlocal, defaults to plain)")
parser.add_option("--coverage", action="store_true", dest="coverage", help="Dump a full coverage report after running")
-
+ parser.add_option("--reversetop", action="store_true", dest="topological", help="Reverse the collection ordering for topological sorts (helps reveal dependency issues)")
+
(options, args) = parser.parse_args()
sys.argv[1:] = args
@@ -106,7 +107,19 @@ def parse_argv():
else:
db = engine.create_engine(db_uri, **db_opts)
db = EngineAssert(db)
-
+
+ if options.topological:
+ from sqlalchemy.orm import unitofwork
+ from sqlalchemy import topological
+ class RevQueueDepSort(topological.QueueDependencySorter):
+ def __init__(self, tuples, allitems):
+ self.tuples = list(tuples)
+ self.allitems = list(allitems)
+ self.tuples.reverse()
+ self.allitems.reverse()
+ topological.QueueDependencySorter = RevQueueDepSort
+ unitofwork.DependencySorter = RevQueueDepSort
+
import logging
logging.basicConfig()
if options.log_info is not None: