summaryrefslogtreecommitdiff
path: root/test/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-06-06 17:50:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-06-06 17:50:32 -0400
commit54b15aaf37917c946e3f4fa45cc1262e14b22ef4 (patch)
treea825d83616e3d3f44abb12c1303d1107c228be92 /test/engine
parent4e6ec9eef4e65c6efabae36b2307f2ad167977da (diff)
downloadsqlalchemy-54b15aaf37917c946e3f4fa45cc1262e14b22ef4.tar.gz
- Added new engine event :meth:`.ConnectionEvents.engine_disposed`.
Called after the :meth:`.Engine.dispose` method is called.
Diffstat (limited to 'test/engine')
-rw-r--r--test/engine/test_execute.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py
index 761ac102a..c7b524335 100644
--- a/test/engine/test_execute.py
+++ b/test/engine/test_execute.py
@@ -484,6 +484,32 @@ class ExecuteTest(fixtures.TestBase):
eq_(canary, ["l1", "l2", "l3", "l1", "l2"])
@testing.requires.ad_hoc_engines
+ def test_dispose_event(self):
+ canary = Mock()
+ eng = create_engine(testing.db.url)
+ event.listen(eng, "engine_disposed", canary)
+
+ conn = eng.connect()
+ conn.close()
+ eng.dispose()
+
+
+ conn = eng.connect()
+ conn.close()
+
+ eq_(
+ canary.mock_calls,
+ [call(eng)]
+ )
+
+ eng.dispose()
+
+ eq_(
+ canary.mock_calls,
+ [call(eng), call(eng)]
+ )
+
+ @testing.requires.ad_hoc_engines
def test_autocommit_option_no_issue_first_connect(self):
eng = create_engine(testing.db.url)
eng.update_execution_options(autocommit=True)