summaryrefslogtreecommitdiff
path: root/test/engine/test_reconnect.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-04-25 21:50:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-04-25 21:50:26 -0400
commite1ec36fc9ebcd652a511c2c7881cdc725a187e7f (patch)
treedc2d91336b0c085304a8856fd4523682905fdb27 /test/engine/test_reconnect.py
parent81a025fca4c801acef1d137d427f3af730151126 (diff)
downloadsqlalchemy-e1ec36fc9ebcd652a511c2c7881cdc725a187e7f.tar.gz
- hardcore force every connection into a strong-referenced set, rollback on every test, close on every context.
this uses pool events but bypasses the pool's fairy/record/dispose services. pypy still seems to expose some holes in that at least as far as what some (or maybe just one, cant find it yet) of the tests does. haven't tested this too deeply, just on sqlite + postgres, cypthon 2.7 + pypy. will see what the buildbot says
Diffstat (limited to 'test/engine/test_reconnect.py')
-rw-r--r--test/engine/test_reconnect.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py
index 44fb4f93b..e945cc692 100644
--- a/test/engine/test_reconnect.py
+++ b/test/engine/test_reconnect.py
@@ -1,13 +1,14 @@
from test.lib.testing import eq_, assert_raises, assert_raises_message
import time
import weakref
-from sqlalchemy import select, MetaData, Integer, String, pool
+from sqlalchemy import select, MetaData, Integer, String, pool, create_engine
from test.lib.schema import Table, Column
import sqlalchemy as tsa
from test.lib import testing, engines
from test.lib.util import gc_collect
from sqlalchemy import exc
from test.lib import fixtures
+from test.lib.engines import testing_engine
class MockDisconnect(Exception):
pass
@@ -54,13 +55,18 @@ class MockReconnectTest(fixtures.TestBase):
global db, dbapi
dbapi = MockDBAPI()
- db = tsa.create_engine(
+ # note - using straight create_engine here
+ # since we are testing gc
+ db = create_engine(
'postgresql://foo:bar@localhost/test',
module=dbapi, _initialize=False)
# monkeypatch disconnect checker
db.dialect.is_disconnect = lambda e, conn, cursor: isinstance(e, MockDisconnect)
+ def teardown(self):
+ db.dispose()
+
def test_reconnect(self):
"""test that an 'is_disconnect' condition will invalidate the
connection, and additionally dispose the previous connection
@@ -198,9 +204,9 @@ class CursorErrTest(fixtures.TestBase):
dbapi = MDBAPI()
- db = tsa.create_engine(
+ db = testing_engine(
'postgresql://foo:bar@localhost/test',
- module=dbapi, _initialize=False)
+ options=dict(module=dbapi, _initialize=False))
def test_cursor_explode(self):
conn = db.connect()