summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-05 12:46:28 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-05 12:46:28 -0400
commitdf7a3792f558dd5f4e39c7ca1f6feda9753be1f1 (patch)
tree330425f65b908158bd578e80b2d0bae4c84e5b98
parent307c6f9773ad80f3eea32da72b02c8ad50a797e9 (diff)
downloadsqlalchemy-df7a3792f558dd5f4e39c7ca1f6feda9753be1f1.tar.gz
- add req's for predictable gc
-rw-r--r--test/engine/test_pool.py2
-rw-r--r--test/ext/declarative/test_clsregistry.py2
-rw-r--r--test/lib/requires.py25
-rw-r--r--test/orm/test_attributes.py3
-rw-r--r--test/orm/test_hasparent.py3
-rw-r--r--test/orm/test_session.py9
-rw-r--r--test/orm/test_transaction.py1
7 files changed, 30 insertions, 15 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py
index e5e3b42ce..6f00a3c80 100644
--- a/test/engine/test_pool.py
+++ b/test/engine/test_pool.py
@@ -426,6 +426,7 @@ class PoolEventsTest(object): #PoolTestBase):
pool.Pool.dispatch._clear()
class DeprecatedPoolListenerTest(PoolTestBase):
+ @testing.requires.predictable_gc
@testing.uses_deprecated(r".*Use event.listen")
def test_listeners(self):
class InstrumentingListener(object):
@@ -946,6 +947,7 @@ class QueuePoolTest(PoolTestBase):
still_opened = len([c for c in strong_refs if not c.closed])
eq_(still_opened, 2)
+ @testing.requires.predictable_gc
def test_weakref_kaboom(self):
p = self._queuepool_fixture(pool_size=3,
max_overflow=-1, use_threadlocal=True)
diff --git a/test/ext/declarative/test_clsregistry.py b/test/ext/declarative/test_clsregistry.py
index 2bf691a6e..f657beb65 100644
--- a/test/ext/declarative/test_clsregistry.py
+++ b/test/ext/declarative/test_clsregistry.py
@@ -19,6 +19,8 @@ class MockProp(object):
class ClsRegistryTest(fixtures.TestBase):
+ __requires__ = 'predictable_gc',
+
def test_same_module_same_name(self):
base = weakref.WeakValueDictionary()
f1 = MockClass(base, "foo.bar.Foo")
diff --git a/test/lib/requires.py b/test/lib/requires.py
index c9a50c5bc..a7a7552da 100644
--- a/test/lib/requires.py
+++ b/test/lib/requires.py
@@ -186,15 +186,17 @@ def savepoints(fn):
], "savepoints not supported")(fn)
def denormalized_names(fn):
- """Target database must have 'denormalized', i.e. UPPERCASE as case insensitive names."""
+ """Target database must have 'denormalized', i.e.
+ UPPERCASE as case insensitive names."""
return skip_if(
lambda: not testing.db.dialect.requires_name_normalize,
- "Backend does not require denomralized names."
+ "Backend does not require denormalized names."
)(fn)
def schemas(fn):
- """Target database must support external schemas, and have one named 'test_schema'."""
+ """Target database must support external schemas, and have one
+ named 'test_schema'."""
return skip_if([
"sqlte",
@@ -253,18 +255,19 @@ def two_phase_transactions(fn):
"""Target database must support two-phase transactions."""
return skip_if([
- no_support('access', 'not supported by database'),
+ no_support('access', 'two-phase xact not supported by database'),
no_support('firebird', 'no SA implementation'),
- no_support('maxdb', 'not supported by database'),
- no_support('mssql', 'FIXME: guessing, needs confirmation'),
- no_support('oracle', 'no SA implementation'),
- no_support('drizzle', 'not supported by database'),
- no_support('sqlite', 'not supported by database'),
- no_support('sybase', 'FIXME: guessing, needs confirmation'),
+ no_support('maxdb', 'two-phase xact not supported by database'),
+ no_support('mssql', 'two-phase xact not supported by drivers'),
+ no_support('oracle', 'two-phase xact not implemented in SQLA/oracle'),
+ no_support('drizzle', 'two-phase xact not supported by database'),
+ no_support('sqlite', 'two-phase xact not supported by database'),
+ no_support('sybase', 'two-phase xact not supported by drivers/SQLA'),
no_support('postgresql+zxjdbc',
'FIXME: JDBC driver confuses the transaction state, may '
'need separate XA implementation'),
- exclude('mysql', '<', (5, 0, 3), 'not supported by database'),
+ exclude('mysql', '<', (5, 0, 3),
+ 'two-phase xact not supported by database'),
])(fn)
def views(fn):
diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py
index c38c721cc..7c0c9527a 100644
--- a/test/orm/test_attributes.py
+++ b/test/orm/test_attributes.py
@@ -268,6 +268,7 @@ class AttributesTest(fixtures.ORMTest):
self.assert_(o4.mt2[0].a == 'abcde')
self.assert_(o4.mt2[0].b is None)
+ @testing.requires.predictable_gc
def test_state_gc(self):
"""test that InstanceState always has a dict, even after host
object gc'ed."""
@@ -279,7 +280,7 @@ class AttributesTest(fixtures.ORMTest):
f = Foo()
state = attributes.instance_state(f)
f.bar = "foo"
- assert state.dict == {'bar':'foo', state.manager.STATE_ATTR:state}
+ eq_(state.dict, {'bar': 'foo', state.manager.STATE_ATTR: state})
del f
gc_collect()
assert state.obj() is None
diff --git a/test/orm/test_hasparent.py b/test/orm/test_hasparent.py
index 73b9fb3b2..b9d1cb15a 100644
--- a/test/orm/test_hasparent.py
+++ b/test/orm/test_hasparent.py
@@ -89,6 +89,7 @@ class ParentRemovalTest(fixtures.MappedTest):
self._assert_not_hasparent(a1)
+ @testing.requires.predictable_gc
def test_stale_state_positive_gc(self):
User = self.classes.User
s, u1, a1 = self._fixture()
@@ -102,6 +103,7 @@ class ParentRemovalTest(fixtures.MappedTest):
self._assert_not_hasparent(a1)
+ @testing.requires.predictable_gc
def test_stale_state_positive_pk_change(self):
"""Illustrate that we can't easily link a
stale state to a fresh one if the fresh one has
@@ -168,6 +170,7 @@ class ParentRemovalTest(fixtures.MappedTest):
self._assert_not_hasparent(a1)
#self._assert_hasparent(a1)
+ @testing.requires.predictable_gc
def test_stale_state_negative(self):
User = self.classes.User
s, u1, a1 = self._fixture()
diff --git a/test/orm/test_session.py b/test/orm/test_session.py
index 81188dec9..195cc4250 100644
--- a/test/orm/test_session.py
+++ b/test/orm/test_session.py
@@ -600,8 +600,8 @@ class SessionTest(_fixtures.FixtureTest):
assert user not in s
assert s.query(User).count() == 0
-
- def test_weak_ref(self):
+ @testing.requires.predictable_gc
+ def test_weakref(self):
"""test the weak-referencing identity map, which strongly-
references modified items."""
@@ -636,7 +636,8 @@ class SessionTest(_fixtures.FixtureTest):
assert user.name == 'fred'
assert s.identity_map
- def test_weak_ref_pickled(self):
+ @testing.requires.predictable_gc
+ def test_weakref_pickled(self):
users, User = self.tables.users, pickleable.User
s = create_session()
@@ -689,6 +690,7 @@ class SessionTest(_fixtures.FixtureTest):
sa.orm.attributes.instance_state(u2))
+ @testing.requires.predictable_gc
def test_weakref_with_cycles_o2m(self):
Address, addresses, users, User = (self.classes.Address,
self.tables.addresses,
@@ -722,6 +724,7 @@ class SessionTest(_fixtures.FixtureTest):
user = s.query(User).options(joinedload(User.addresses)).one()
eq_(user, User(name="ed", addresses=[Address(email_address="ed2")]))
+ @testing.requires.predictable_gc
def test_weakref_with_cycles_o2o(self):
Address, addresses, users, User = (self.classes.Address,
self.tables.addresses,
diff --git a/test/orm/test_transaction.py b/test/orm/test_transaction.py
index b657cd464..edae617d6 100644
--- a/test/orm/test_transaction.py
+++ b/test/orm/test_transaction.py
@@ -544,6 +544,7 @@ class AutoExpireTest(_LocalFixture):
assert u1 in s
assert u1 not in s.deleted
+ @testing.requires.predictable_gc
def test_gced_delete_on_rollback(self):
User, users = self.classes.User, self.tables.users