From: Charles-Axel Dein Date: Mon, 8 Jun 2015 17:01:59 +0000 (-0700) Subject: Expire session in testing transaction handling X-Git-Tag: rel_0_9_10~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0bad98cdafa2d218ba61f9aae021f652a353a6d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Expire session in testing transaction handling (cherry picked from commit d1dc39d55d111cdeffa663deec773d8bb67d237e) --- diff --git a/doc/build/orm/session_transaction.rst b/doc/build/orm/session_transaction.rst index 24a8446501..08f11afccb 100644 --- a/doc/build/orm/session_transaction.rst +++ b/doc/build/orm/session_transaction.rst @@ -484,7 +484,9 @@ everything is rolled back. from sqlalchemy import event + class SomeTest(TestCase): + def setUp(self): # connect to the database self.connection = engine.connect() @@ -503,6 +505,6 @@ everything is rolled back. def restart_savepoint(session, transaction): if transaction.nested and not transaction._parent.nested: session.begin_nested() - + session.expire_all() # ... the tearDown() method stays the same