File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -210,10 +210,17 @@ class SessionFixture(fixtures.Fixture):
210
210
:param debug: If true, send all DB statements emitted to the log.
211
211
"""
212
212
213
- def __init__ (self , database_fixture , future = False , debug = False ):
213
+ def __init__ (
214
+ self ,
215
+ database_fixture ,
216
+ future = False ,
217
+ debug = False ,
218
+ expire_on_commit = True ,
219
+ ):
214
220
super ().__init__ ()
215
221
self .database = database_fixture
216
222
self .future = future
223
+ self .expire_on_commit = expire_on_commit
217
224
if debug :
218
225
self .database .engine .echo = True
219
226
from logging import Formatter , getLogger
@@ -228,7 +235,7 @@ def setUp(self):
228
235
self .connection = self .database .connect ()
229
236
self .txn = self .connection .begin ()
230
237
self .configure_session ()
231
- self .session = self .Session ()
238
+ self .session = self .Session (expire_on_commit = self . expire_on_commit )
232
239
# Even if the DB won't do savepoints, begin a nested transaction
233
240
# anyway. This makes SQLite tests pass.
234
241
self .set_up_savepoint ()
You can’t perform that action at this time.
0 commit comments